diff --git a/app/rest/admin.go b/app/rest/admin.go index ab9680db..4ae2f135 100644 --- a/app/rest/admin.go +++ b/app/rest/admin.go @@ -117,14 +117,16 @@ func (a *admin) checkBlocked(locator store.Locator, user store.User) bool { // processes comments and hides text of all comments for blocked users. // resets score and votes too func (a *admin) maskBlockedUsers(comments []store.Comment) (res []store.Comment) { - for _, c := range comments { + res = make([]store.Comment, len(comments)) + for i, c := range comments { if a.dataService.IsBlocked(c.Locator, c.User.ID) { c.User.Blocked = true c.Text = "this comment was deleted" c.Score = 0 c.Votes = map[string]bool{} + c.Edit = nil } - res = append(res, c) + res[i] = c } return res } diff --git a/app/rest/server.go b/app/rest/server.go index 72fd1a17..8bfd9028 100644 --- a/app/rest/server.go +++ b/app/rest/server.go @@ -241,7 +241,7 @@ func (s *Server) findCommentsCtrl(w http.ResponseWriter, r *http.Request) { }) if err != nil { - common.SendErrorJSON(w, r, http.StatusInternalServerError, err, "can't find comments") + common.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't find comments") return } renderJSONFromBytes(w, r, data)