diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-08-04 11:38:09 -0400 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2016-08-04 10:38:09 -0500 |
commit | 0184d6059bb1943fb74bf33d1d200a423c5bf5e6 (patch) | |
tree | 4b8480d65d5ec181b372a09f946bb7649809a467 /api/post_test.go | |
parent | 9b50b5028391ee29922ad5549b785ac2312be368 (diff) | |
download | chat-0184d6059bb1943fb74bf33d1d200a423c5bf5e6.tar.gz chat-0184d6059bb1943fb74bf33d1d200a423c5bf5e6.tar.bz2 chat-0184d6059bb1943fb74bf33d1d200a423c5bf5e6.zip |
PLT-3506 Added flagged posts functionality (#3679)
* Added flagged posts functionality
* UI Improvements to flags (#3697)
* Added flag functionality for mobile
* Updating flagged text (#3699)
* Add back button to RHS thread when coming from flagged posts
* Updating position of flags (#3708)
* Plt 3506 - Reverting flag position (#3724)
* Revert "Updating position of flags (#3708)"
This reverts commit aaa05632c5d9eda35a048300a5bd7e99584c5b58.
* Fixing the icon in search
* Help text and white space improvements (#3730)
* Updatng help text and some white spacing.
* Updating help text
Diffstat (limited to 'api/post_test.go')
-rw-r--r-- | api/post_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/api/post_test.go b/api/post_test.go index 29fe63ddc..2a2a9f41b 100644 --- a/api/post_test.go +++ b/api/post_test.go @@ -924,3 +924,38 @@ func TestGetOutOfChannelMentions(t *testing.T) { t.Fatalf("getOutOfChannelMentions returned %v when two users on a different team were mentioned", mentioned) } } + +func TestGetFlaggedPosts(t *testing.T) { + th := Setup().InitBasic() + Client := th.BasicClient + user1 := th.BasicUser + post1 := th.BasicPost + + preferences := &model.Preferences{ + { + UserId: user1.Id, + Category: model.PREFERENCE_CATEGORY_FLAGGED_POST, + Name: post1.Id, + Value: "true", + }, + } + Client.Must(Client.SetPreferences(preferences)) + + r1 := Client.Must(Client.GetFlaggedPosts(0, 2)).Data.(*model.PostList) + + if len(r1.Order) == 0 { + t.Fatal("should have gotten a flagged post") + } + + if _, ok := r1.Posts[post1.Id]; !ok { + t.Fatal("missing flagged post") + } + + Client.DeletePreferences(preferences) + + r2 := Client.Must(Client.GetFlaggedPosts(0, 2)).Data.(*model.PostList) + + if len(r2.Order) != 0 { + t.Fatal("should not have gotten a flagged post") + } +} |