summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/notification.go6
-rw-r--r--app/notification_test.go24
2 files changed, 27 insertions, 3 deletions
diff --git a/app/notification.go b/app/notification.go
index 5b7ed5ad2..06c1c19bc 100644
--- a/app/notification.go
+++ b/app/notification.go
@@ -842,15 +842,15 @@ func GetExplicitMentions(message string, keywords map[string][]string) *Explicit
checkForMention := func(word string) bool {
isMention := false
- if word == "@here" {
+ if strings.ToLower(word) == "@here" {
ret.HereMentioned = true
}
- if word == "@channel" {
+ if strings.ToLower(word) == "@channel" {
ret.ChannelMentioned = true
}
- if word == "@all" {
+ if strings.ToLower(word) == "@all" {
ret.AllMentioned = true
}
diff --git a/app/notification_test.go b/app/notification_test.go
index 1abdd3d61..8df19e2bf 100644
--- a/app/notification_test.go
+++ b/app/notification_test.go
@@ -186,6 +186,17 @@ func TestGetExplicitMentions(t *testing.T) {
ChannelMentioned: true,
},
},
+ "CapitalizedChannel": {
+ Message: "this is an message for @cHaNNeL",
+ Keywords: map[string][]string{"@channel": {id1, id2}},
+ Expected: &ExplicitMentions{
+ MentionedUserIds: map[string]bool{
+ id1: true,
+ id2: true,
+ },
+ ChannelMentioned: true,
+ },
+ },
"All": {
Message: "this is an message for @all",
Keywords: map[string][]string{"@all": {id1, id2}},
@@ -197,6 +208,17 @@ func TestGetExplicitMentions(t *testing.T) {
AllMentioned: true,
},
},
+ "CapitalizedAll": {
+ Message: "this is an message for @ALL",
+ Keywords: map[string][]string{"@all": {id1, id2}},
+ Expected: &ExplicitMentions{
+ MentionedUserIds: map[string]bool{
+ id1: true,
+ id2: true,
+ },
+ AllMentioned: true,
+ },
+ },
"UserWithPeriod": {
Message: "user.period doesn't complicate things at all by including periods in their username",
Keywords: map[string][]string{"user.period": {id1}, "user": {id2}},
@@ -439,6 +461,8 @@ func TestGetExplicitMentionsAtHere(t *testing.T) {
"?@here?": true,
"`@here`": false, // This case shouldn't mention since it's a code block
"~@here~": true,
+ "@HERE": true,
+ "@hERe": true,
}
for message, shouldMention := range cases {