summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store_test.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_test.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_test.go')
-rw-r--r--store/sql_post_store_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index d8f8c2e6b..594e923be 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -923,6 +923,14 @@ func TestPostStoreGetFlaggedPosts(t *testing.T) {
o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
+ o3 := &model.Post{}
+ o3.ChannelId = o1.ChannelId
+ o3.UserId = model.NewId()
+ o3.Message = "a" + model.NewId() + "b"
+ o3.DeleteAt = 1
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
+ time.Sleep(2 * time.Millisecond)
+
r1 := (<-store.Post().GetFlaggedPosts(o1.ChannelId, 0, 2)).Data.(*model.PostList)
if len(r1.Order) != 0 {
@@ -968,4 +976,19 @@ func TestPostStoreGetFlaggedPosts(t *testing.T) {
if len(r4.Order) != 2 {
t.Fatal("should have 2 posts")
}
+
+ preferences = model.Preferences{
+ {
+ UserId: o1.UserId,
+ Category: model.PREFERENCE_CATEGORY_FLAGGED_POST,
+ Name: o3.Id,
+ Value: "true",
+ },
+ }
+
+ Must(store.Preference().Save(&preferences))
+
+ if len(r4.Order) != 2 {
+ t.Fatal("should have 2 posts")
+ }
}