MM-29379 Ignore channel mentions when channel is muted and channel mention setting is not updated by the user (#15992)

Этот коммит содержится в:
sowmiyamuthuraman
2020-11-04 14:43:24 +05:30
коммит произвёл GitHub
родитель 66731e2740
Коммит 5a6d8387f5
2 изменённых файлов: 26 добавлений и 1 удалений

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

@@ -1548,6 +1548,30 @@ func TestAddMentionKeywordsForUser(t *testing.T) {
assert.NotContains(t, keywords["@here"], user.Id)
})
t.Run("should not add @channel/@all/@here when channel is muted and channel mention setting is not updated by user", func(t *testing.T) {
user := &model.User{
Id: model.NewId(),
Username: "user",
NotifyProps: map[string]string{
model.CHANNEL_MENTIONS_NOTIFY_PROP: "true",
},
}
channelNotifyProps := map[string]string{
model.MARK_UNREAD_NOTIFY_PROP: model.USER_NOTIFY_MENTION,
model.IGNORE_CHANNEL_MENTIONS_NOTIFY_PROP: model.IGNORE_CHANNEL_MENTIONS_DEFAULT,
}
status := &model.Status{
Status: model.STATUS_ONLINE,
}
keywords := map[string][]string{}
addMentionKeywordsForUser(keywords, user, channelNotifyProps, status, true)
assert.NotContains(t, keywords["@channel"], user.Id)
assert.NotContains(t, keywords["@all"], user.Id)
assert.NotContains(t, keywords["@here"], user.Id)
})
t.Run("should not add @here when when user is not online", func(t *testing.T) {
user := &model.User{
Id: model.NewId(),