MM-16949 Fix posts returned from unread API when the two different list contains parent post and comments (#11617)

* fix posts returned from unread API when the list contains parent post/s

* add ExtendAll to PostList and update test per feedback

* revert unintentional change to the other test and fix comment

* update the existing postlist.Extend, filter unique values and update unit tests
Этот коммит содержится в:
Saturnino Abril
2019-07-18 02:05:43 +08:00
коммит произвёл GitHub
родитель d4727ec649
Коммит aef5ef4ed0
3 изменённых файлов: 91 добавлений и 26 удалений

Просмотреть файл

@@ -1717,11 +1717,17 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
post3 := th.CreatePost()
post4 := th.CreatePost()
th.CreatePost() // post5
post6 := th.CreatePost()
post7 := th.CreatePost()
post8 := th.CreatePost()
post9 := th.CreatePost()
post10 := th.CreatePost()
replyPost := &model.Post{ChannelId: channelId, Message: model.NewId(), RootId: post4.Id, ParentId: post4.Id}
post6, resp := Client.CreatePost(replyPost)
CheckNoError(t, resp)
post7, resp := Client.CreatePost(replyPost)
CheckNoError(t, resp)
post8, resp := Client.CreatePost(replyPost)
CheckNoError(t, resp)
post9, resp := Client.CreatePost(replyPost)
CheckNoError(t, resp)
post10, resp := Client.CreatePost(replyPost)
CheckNoError(t, resp)
// All returned posts are all read by the user, since it's created by the user itself.
posts, resp := Client.GetPostsAroundLastUnread(userId, channelId, 20, 20)