MM-35396 Refactor GetThreadForUser store func to take membership as argument to prevent replica lag issues and reduce joins in query (#17754)
* Update store function GetThreadForUser to use master DB to fix replica lag * Refactor GetThreadForUser store func to take membership as argument to prevent replica lag issues and reduce joins in query * Add translation * Fix test * Updates per feedback * Minor clean-up per feedback
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
24fb0033f4
Коммит
d0778486ad
@@ -339,14 +339,14 @@ func testThreadStorePopulation(t *testing.T, ss store.Store) {
|
||||
newPosts := makeSomePosts()
|
||||
m, err := ss.Thread().MaintainMembership(newPosts[0].UserId, newPosts[0].Id, true, false, true, false, false)
|
||||
require.NoError(t, err)
|
||||
th, err := ss.Thread().GetThreadForUser(newPosts[0].UserId, "", newPosts[0].Id, false)
|
||||
th, err := ss.Thread().GetThreadForUser("", m, false)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int64(2), th.UnreadReplies)
|
||||
|
||||
m.LastViewed = newPosts[2].UpdateAt + 1
|
||||
_, err = ss.Thread().UpdateMembership(m)
|
||||
require.NoError(t, err)
|
||||
th, err = ss.Thread().GetThreadForUser(newPosts[0].UserId, "", newPosts[0].Id, false)
|
||||
th, err = ss.Thread().GetThreadForUser("", m, false)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int64(0), th.UnreadReplies)
|
||||
|
||||
@@ -355,7 +355,7 @@ func testThreadStorePopulation(t *testing.T, ss store.Store) {
|
||||
_, err = ss.Post().Update(editedPost, newPosts[2])
|
||||
require.NoError(t, err)
|
||||
|
||||
th, err = ss.Thread().GetThreadForUser(newPosts[0].UserId, "", newPosts[0].Id, false)
|
||||
th, err = ss.Thread().GetThreadForUser("", m, false)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, int64(0), th.UnreadReplies)
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user