summaryrefslogtreecommitdiffstats
path: root/app/notification_test.go
diff options
context:
space:
mode:
authorSiyuan Liu <liusy182@hotmail.com>2017-12-16 04:16:31 +0800
committerChris <ccbrown112@gmail.com>2017-12-15 14:16:31 -0600
commita37d53c732a0da0aa5fa8825ee917c5f57656a87 (patch)
tree088eda3f9b03fe4c5ecd3f7cab18aebc43491ef4 /app/notification_test.go
parent95bdb51f4070e7bdb246798106beab6e4c1e11a6 (diff)
downloadchat-a37d53c732a0da0aa5fa8825ee917c5f57656a87.tar.gz
chat-a37d53c732a0da0aa5fa8825ee917c5f57656a87.tar.bz2
chat-a37d53c732a0da0aa5fa8825ee917c5f57656a87.zip
PLT-8350 "mention" when channel user count equals to max allowed num (#7976)
Diffstat (limited to 'app/notification_test.go')
-rw-r--r--app/notification_test.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/notification_test.go b/app/notification_test.go
index 5ae765649..c5d0f8478 100644
--- a/app/notification_test.go
+++ b/app/notification_test.go
@@ -544,7 +544,8 @@ func TestGetMentionKeywords(t *testing.T) {
return duplicate_frequency
}
- // multiple users
+ // multiple users but no more than MaxNotificationsPerChannel
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.MaxNotificationsPerChannel = 4 })
profiles = map[string]*model.User{
user1.Id: user1,
user2.Id: user2,
@@ -568,6 +569,19 @@ func TestGetMentionKeywords(t *testing.T) {
t.Fatal("should've mentioned user3 and user4 with @all")
}
+ // multiple users and more than MaxNotificationsPerChannel
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.MaxNotificationsPerChannel = 3 })
+ mentions = th.App.GetMentionKeywordsInChannel(profiles, true)
+ if len(mentions) != 4 {
+ t.Fatal("should've returned four mention keywords")
+ } else if _, ok := mentions["@channel"]; ok {
+ t.Fatal("should not have mentioned any user with @channel")
+ } else if _, ok := mentions["@all"]; ok {
+ t.Fatal("should not have mentioned any user with @all")
+ } else if _, ok := mentions["@here"]; ok {
+ t.Fatal("should not have mentioned any user with @here")
+ }
+
// no special mentions
profiles = map[string]*model.User{
user1.Id: user1,