summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.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 /store/sql_post_store.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 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index 07192b4a6..b844bfbca 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -149,7 +149,7 @@ func (s SqlPostStore) GetFlaggedPosts(userId string, offset int, limit int) Stor
pl := &model.PostList{}
var posts []*model.Post
- if _, err := s.GetReplica().Select(&posts, "SELECT * FROM Posts WHERE Id IN (SELECT Name FROM Preferences WHERE UserId = :UserId AND Category = :Category) ORDER BY CreateAt ASC LIMIT :Limit OFFSET :Offset", map[string]interface{}{"UserId": userId, "Category": model.PREFERENCE_CATEGORY_FLAGGED_POST, "Offset": offset, "Limit": limit}); err != nil {
+ if _, err := s.GetReplica().Select(&posts, "SELECT * FROM Posts WHERE Id IN (SELECT Name FROM Preferences WHERE UserId = :UserId AND Category = :Category) AND DeleteAt = 0 ORDER BY CreateAt ASC LIMIT :Limit OFFSET :Offset", map[string]interface{}{"UserId": userId, "Category": model.PREFERENCE_CATEGORY_FLAGGED_POST, "Offset": offset, "Limit": limit}); err != nil {
result.Err = model.NewLocAppError("SqlPostStore.GetFlaggedPosts", "store.sql_post.get_flagged_posts.app_error", nil, err.Error())
} else {
for _, post := range posts {