From 3e98c31ffb90ccae6fcd400c932226538900757f Mon Sep 17 00:00:00 2001 From: Umputun Date: Fri, 18 May 2018 15:15:54 -0500 Subject: [PATCH] return full comment on create request --- README.md | 1 + app/rest/api/rest.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e0f4519..1604481c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/rest/api/rest.go b/app/rest/api/rest.go index cd7e6748..67f9fe69 100644 --- a/app/rest/api/rest.go +++ b/app/rest/api/rest.go @@ -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) {