From bbf6c81a065d7d2c550b6a629cf31cc113b3713e Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 10 Aug 2017 08:41:34 -0400 Subject: Fix out-of-channel mentions for usernames with dashes (#7151) --- app/notification.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'app') 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) } -- cgit v1.2.3-1-g7c22