MM-45395: Exclude bot and webhook posts from Top Team Channels. Exclude webhook posts from My Top Channels. (#20599)

* MM-45395: Exclude bot and webhook posts from Top Team Channels. Exclude webhook posts from My Top Channels.

* MM-45395: Adds missing error test.

* MM-45395: Adds missing whitespace.
Этот коммит содержится в:
Martin Kraft
2022-07-11 08:58:40 -04:00
коммит произвёл GitHub
родитель f639122376
Коммит a46840e96b
3 изменённых файлов: 88 добавлений и 11 удалений

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

@@ -2382,7 +2382,31 @@ func TestGetTopChannelsForTeamSince(t *testing.T) {
defer th.TearDown()
channel2 := th.CreateChannel(th.BasicTeam)
// add a bot post to ensure it's not counted
_, err := th.Server.Store.Post().Save(&model.Post{
Message: "hello from a bot",
ChannelId: channel2.Id,
UserId: th.BasicUser.Id,
Props: model.StringInterface{
"from_bot": true,
},
})
require.NoError(t, err)
channel3 := th.CreatePrivateChannel(th.BasicTeam)
// add a webhook post to ensure it's not counted
_, err = th.Server.Store.Post().Save(&model.Post{
Message: "hello from a webhook",
ChannelId: channel3.Id,
UserId: th.BasicUser.Id,
Props: model.StringInterface{
"from_webhook": true,
},
})
require.NoError(t, err)
channel4 := th.CreatePrivateChannel(th.BasicTeam)
channel5 := th.CreateChannel(th.BasicTeam)
channel6 := th.CreatePrivateChannel(th.BasicTeam)
@@ -2436,7 +2460,31 @@ func TestGetTopChannelsForUserSince(t *testing.T) {
defer th.TearDown()
channel2 := th.CreateChannel(th.BasicTeam)
// add a bot post to ensure it's not counted
_, err := th.Server.Store.Post().Save(&model.Post{
Message: "hello from a bot",
ChannelId: channel2.Id,
UserId: th.BasicUser.Id,
Props: model.StringInterface{
"from_bot": true,
},
})
require.NoError(t, err)
channel3 := th.CreatePrivateChannel(th.BasicTeam)
// add a webhook post to ensure it's not counted
_, err = th.Server.Store.Post().Save(&model.Post{
Message: "hello from a webhook",
ChannelId: channel3.Id,
UserId: th.BasicUser.Id,
Props: model.StringInterface{
"from_webhook": true,
},
})
require.NoError(t, err)
channel4 := th.CreatePrivateChannel(th.BasicTeam)
channel5 := th.CreateChannel(th.BasicTeam)
channel6 := th.CreatePrivateChannel(th.BasicTeam)