Use ID in path rather than an invisible input when publishing, rejecting or resubmitting an article
This commit is contained in:
@ -69,9 +69,9 @@ func main() {
|
||||
mux.HandleFunc("POST /add-tag/", view.AddTag(args, db, store))
|
||||
mux.HandleFunc("POST /add-user/", view.AddUser(args, db, store))
|
||||
mux.HandleFunc("POST /login/", view.Login(args, db, store))
|
||||
mux.HandleFunc("POST /publish-article/", view.PublishArticle(args, db, store))
|
||||
mux.HandleFunc("POST /reject-article/", view.RejectArticle(args, db, store))
|
||||
mux.HandleFunc("POST /resubmit-article/", view.ResubmitArticle(args, db, store))
|
||||
mux.HandleFunc("POST /publish-article/{id}/", view.PublishArticle(args, db, store))
|
||||
mux.HandleFunc("POST /reject-article/{id}/", view.RejectArticle(args, db, store))
|
||||
mux.HandleFunc("POST /resubmit-article/{id}/", view.ResubmitArticle(args, db, store))
|
||||
mux.HandleFunc("POST /review-rejected-article/", view.ReviewRejectedArticle(args, db, store))
|
||||
mux.HandleFunc("POST /review-unpublished-article/", view.ReviewUnpublishedArticle(args, db, store))
|
||||
mux.HandleFunc("POST /submit-article/", view.SubmitArticle(args, db, store))
|
||||
|
@ -92,7 +92,7 @@ func SubmitArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) htt
|
||||
|
||||
func ResubmitArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
id, err := strconv.ParseInt(r.PostFormValue("article-id"), 10, 64)
|
||||
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
@ -278,7 +278,7 @@ func ReviewRejectedArticle(c *control.CliArgs, db *model.DB, s *control.CookieSt
|
||||
|
||||
func PublishArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
id, err := strconv.ParseInt(r.PostFormValue("id"), 10, 64)
|
||||
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
@ -333,7 +333,7 @@ func PublishArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) ht
|
||||
|
||||
func RejectArticle(c *control.CliArgs, db *model.DB, s *control.CookieStore) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
id, err := strconv.ParseInt(r.PostFormValue("id"), 10, 64)
|
||||
id, err := strconv.ParseInt(r.PathValue("id"), 10, 64)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user