return full comment on create request

This commit is contained in:
Umputun
2018-05-18 15:15:54 -05:00
parent d9d423c055
commit 3e98c31ffb
2 changed files with 8 additions and 1 deletions
+1
View File
@@ -10,6 +10,7 @@ Remark42 is a self-hosted, lightweight, and simple (yet functional) comment engi
* Voting and pinning system
* Sortable comments
* Extractor for recent comments, cross-post
* RSS for all comments and each post
* Export data to json with automatic backups
* No external databases, everything embedded in a single data file
* Fully dockerized and can be deployed in a single command
+7 -1
View File
@@ -187,9 +187,15 @@ func (s *Rest) createCommentCtrl(w http.ResponseWriter, r *http.Request) {
return
}
// DataService modifies comment
finalComment, err := s.DataService.Get(comment.Locator, id)
if err != nil {
rest.SendErrorJSON(w, r, http.StatusInternalServerError, err, "can't load created comment")
return
}
s.Cache.Flush() // reset all caches
render.Status(r, http.StatusCreated)
render.JSON(w, r, JSON{"id": id, "locator": comment.Locator})
render.JSON(w, r, &finalComment)
}
func (s *Rest) previewCommentCtrl(w http.ResponseWriter, r *http.Request) {