forked from jason/cpolis
Make banner link and summary optional
This commit is contained in:
@ -80,7 +80,7 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
||||
|
||||
article := &b.Article{
|
||||
Title: r.PostFormValue("article-title"),
|
||||
BannerLink: r.PostFormValue("article-banner-url"),
|
||||
BannerLink: c.Domain + "/image/serve/" + r.PostFormValue("article-banner-url"),
|
||||
Summary: r.PostFormValue("article-summary"),
|
||||
Published: false,
|
||||
Rejected: false,
|
||||
@ -94,17 +94,6 @@ func SubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
if len(article.BannerLink) == 0 {
|
||||
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
article.BannerLink = c.Domain + "/image/serve/" + article.BannerLink
|
||||
|
||||
if len(article.Summary) == 0 {
|
||||
http.Error(w, "Bitte die Beschreibung eingeben.", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
article.ID, err = db.AddArticle(article)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
@ -185,17 +174,11 @@ func ResubmitArticle(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
|
||||
}
|
||||
|
||||
bannerLink := r.PostFormValue("article-banner-url")
|
||||
if len(bannerLink) == 0 {
|
||||
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
||||
return
|
||||
if len(bannerLink) != 0 {
|
||||
bannerLink = c.Domain + "/image/serve/" + bannerLink
|
||||
}
|
||||
bannerLink = c.Domain + "/image/serve/" + bannerLink
|
||||
|
||||
summary := r.PostFormValue("article-summary")
|
||||
if len(summary) == 0 {
|
||||
http.Error(w, "Bitte die Beschreibung eingeben.", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
content := r.PostFormValue("article-content")
|
||||
if len(content) == 0 {
|
||||
|
@ -41,10 +41,6 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun
|
||||
http.Error(w, "Bitte den Titel eingeben.", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if len(article.BannerLink) == 0 {
|
||||
http.Error(w, "Bitte ein Titelbild einfügen.", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
article.ID, err = db.AddArticle(article)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user