summaryrefslogtreecommitdiffstats
path: root/app/notification.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-08-10 08:41:34 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2017-08-10 08:41:34 -0400
commitbbf6c81a065d7d2c550b6a629cf31cc113b3713e (patch)
treea244168551977b249b53402278a06aa7a0314d42 /app/notification.go
parentffbf8e51fe0b80b39fa76535f96c9179b2fcc0a1 (diff)
downloadchat-bbf6c81a065d7d2c550b6a629cf31cc113b3713e.tar.gz
chat-bbf6c81a065d7d2c550b6a629cf31cc113b3713e.tar.bz2
chat-bbf6c81a065d7d2c550b6a629cf31cc113b3713e.zip
Fix out-of-channel mentions for usernames with dashes (#7151)
Diffstat (limited to 'app/notification.go')
-rw-r--r--app/notification.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/notification.go b/app/notification.go
index f8b0dd7ce..4fec40040 100644
--- a/app/notification.go
+++ b/app/notification.go
@@ -828,12 +828,14 @@ func GetExplicitMentions(message string, keywords map[string][]string) (map[stri
// Case-sensitive check for first name
if ids, match := keywords[splitWord]; match {
addMentionedUsers(ids)
- } else if _, ok := systemMentions[word]; !ok && strings.HasPrefix(word, "@") {
- username := word[1:len(splitWord)]
+ } else if _, ok := systemMentions[splitWord]; !ok && strings.HasPrefix(splitWord, "@") {
+ username := splitWord[1:]
potentialOthersMentioned = append(potentialOthersMentioned, username)
}
}
- } else if _, ok := systemMentions[word]; !ok && strings.HasPrefix(word, "@") {
+ }
+
+ if _, ok := systemMentions[word]; !ok && strings.HasPrefix(word, "@") {
username := word[1:]
potentialOthersMentioned = append(potentialOthersMentioned, username)
}