MM-49547: Handle Top DM case for deleted second user (#22049)
* Ignore archived DM channels with deleted second user * Add tests * Add store test * Add error check for post delete in test --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7a8c1f587b
Коммит
8c34e6c80c
@@ -3292,4 +3292,19 @@ func TestGetTopDMsForUserSince(t *testing.T) {
|
||||
require.Equal(t, topDMs.Items[0].SecondParticipant.Id, u3.Id)
|
||||
require.Equal(t, topDMs.Items[0].MessageCount, int64(4))
|
||||
})
|
||||
|
||||
t.Run("topDMs will not consider deleted second user", func(t *testing.T) {
|
||||
// u4 only takes part in one conversation
|
||||
topDMs, err := th.App.GetTopDMsForUserSince(u4.Id, &model.InsightsOpts{StartUnixMilli: 100, Page: 0, PerPage: 100})
|
||||
require.Nil(t, err)
|
||||
// len of topDMs.Items should be 1
|
||||
require.Len(t, topDMs.Items, 1)
|
||||
// delete user3
|
||||
err = th.App.PermanentDeleteUser(th.Context, u3)
|
||||
require.Nil(t, err)
|
||||
topDMs, err = th.App.GetTopDMsForUserSince(u4.Id, &model.InsightsOpts{StartUnixMilli: 100, Page: 0, PerPage: 100})
|
||||
require.Nil(t, err)
|
||||
// len of topDMs.Items should be 0 since u3 is deleted
|
||||
require.Len(t, topDMs.Items, 0)
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user