MM-20649 Fix incorrect mention count when marking a DM channel as unread (#13245)
* MM-20649 Fix incorrect mention count when marking a DM channel as unread * Satisfy govet * Update missed test
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4e5369e759
Коммит
a0130b86d7
@@ -16,7 +16,6 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/einterfaces/mocks"
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/plugin/plugintest/mock"
|
||||
"github.com/mattermost/mattermost-server/v5/store"
|
||||
"github.com/mattermost/mattermost-server/v5/store/storetest"
|
||||
)
|
||||
|
||||
@@ -1261,7 +1260,7 @@ func TestCountMentionsFromPost(t *testing.T) {
|
||||
assert.Equal(t, 2, count)
|
||||
})
|
||||
|
||||
t.Run("should return store.MentionAllPosts for a direct channel", func(t *testing.T) {
|
||||
t.Run("should return the number of posts made by the other user for a direct channel", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1278,10 +1277,22 @@ func TestCountMentionsFromPost(t *testing.T) {
|
||||
}, channel, false)
|
||||
require.Nil(t, err)
|
||||
|
||||
_, err = th.App.CreatePost(&model.Post{
|
||||
UserId: user1.Id,
|
||||
ChannelId: channel.Id,
|
||||
Message: "test2",
|
||||
}, channel, false)
|
||||
require.Nil(t, err)
|
||||
|
||||
count, err := th.App.countMentionsFromPost(user2, post1)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, store.MentionAllPosts, count)
|
||||
assert.Equal(t, 2, count)
|
||||
|
||||
count, err = th.App.countMentionsFromPost(user1, post1)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 0, count)
|
||||
})
|
||||
|
||||
t.Run("should not count mentions from the before the given post", func(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user