MM-3543/MM-35436: fix thread being marked unread when updating reply post (#17645)
Summary Threads should not be returned as unread if a reply post has been edited or reacted to since the time the thread was last viewed Ticket Link https://mattermost.atlassian.net/browse/MM-35436 https://mattermost.atlassian.net/browse/MM-35437
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0aad9f7412
Коммит
6f5e14dd5e
@@ -5515,6 +5515,51 @@ func TestGetThreadsForUser(t *testing.T) {
|
||||
require.NotNil(t, uss3.Threads)
|
||||
require.Len(t, uss3.Threads, 0)
|
||||
})
|
||||
|
||||
t.Run("editing or reacting to reply post does not make thread unread", func(t *testing.T) {
|
||||
Client := th.Client
|
||||
|
||||
rootPost, _ := postAndCheck(t, Client, &model.Post{ChannelId: th.BasicChannel.Id, Message: "root post"})
|
||||
replyPost, _ := postAndCheck(t, th.SystemAdminClient, &model.Post{ChannelId: th.BasicChannel.Id, Message: "reply post", RootId: rootPost.Id})
|
||||
uss, resp := th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
})
|
||||
CheckNoError(t, resp)
|
||||
require.Equal(t, uss.TotalUnreadThreads, int64(1))
|
||||
require.Equal(t, uss.Threads[0].PostId, rootPost.Id)
|
||||
|
||||
_, resp = th.Client.UpdateThreadReadForUser(th.BasicUser.Id, th.BasicChannel.TeamId, rootPost.Id, model.GetMillis())
|
||||
CheckNoError(t, resp)
|
||||
uss, resp = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
})
|
||||
CheckNoError(t, resp)
|
||||
require.Equal(t, uss.TotalUnreadThreads, int64(0))
|
||||
|
||||
// edit post
|
||||
editedReplyPostMessage := "edited " + replyPost.Message
|
||||
_, resp = th.SystemAdminClient.PatchPost(replyPost.Id, &model.PostPatch{Message: &editedReplyPostMessage})
|
||||
CheckNoError(t, resp)
|
||||
uss, resp = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
})
|
||||
CheckNoError(t, resp)
|
||||
require.Equal(t, uss.TotalUnreadThreads, int64(0))
|
||||
|
||||
// react to post
|
||||
reaction := &model.Reaction{
|
||||
UserId: th.SystemAdminUser.Id,
|
||||
PostId: replyPost.Id,
|
||||
EmojiName: "smile",
|
||||
}
|
||||
_, resp = th.SystemAdminClient.SaveReaction(reaction)
|
||||
CheckNoError(t, resp)
|
||||
uss, resp = th.Client.GetUserThreads(th.BasicUser.Id, th.BasicTeam.Id, model.GetUserThreadsOpts{
|
||||
Deleted: false,
|
||||
})
|
||||
CheckNoError(t, resp)
|
||||
require.Equal(t, uss.TotalUnreadThreads, int64(0))
|
||||
})
|
||||
}
|
||||
|
||||
func TestThreadSocketEvents(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user