summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-08-22 20:36:01 -0400
committerCorey Hulen <corey@hulen.com>2016-08-22 16:36:01 -0800
commit80d83ae77c85de5666dc88458e2888f66c49cc90 (patch)
tree3d5a5864662347529899a07e1009f70f5a326df9 /api/post.go
parentc3c62ad2ad018be6887149e92dd35bb527f55168 (diff)
downloadchat-80d83ae77c85de5666dc88458e2888f66c49cc90.tar.gz
chat-80d83ae77c85de5666dc88458e2888f66c49cc90.tar.bz2
chat-80d83ae77c85de5666dc88458e2888f66c49cc90.zip
Prevent flagging of deleted posts and don't show deleted posts in flagged post list (#3846)
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/api/post.go b/api/post.go
index fa42e6f88..b4c70fab2 100644
--- a/api/post.go
+++ b/api/post.go
@@ -1332,6 +1332,7 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
go Publish(message)
go DeletePostFiles(c.TeamId, post)
+ go DeleteFlaggedPost(c.Session.UserId, post)
result := make(map[string]string)
result["id"] = postId
@@ -1339,6 +1340,13 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
+func DeleteFlaggedPost(userId string, post *model.Post) {
+ if result := <-Srv.Store.Preference().Delete(userId, model.PREFERENCE_CATEGORY_FLAGGED_POST, post.Id); result.Err != nil {
+ l4g.Warn(utils.T("api.post.delete_flagged_post.app_error.warn"), result.Err)
+ return
+ }
+}
+
func DeletePostFiles(teamId string, post *model.Post) {
if len(post.Filenames) == 0 {
return