From 088f76ad6e2d10a1c50ef548f2226213271abde3 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 2 Apr 2018 12:40:28 -0400 Subject: MM-9868 Fixed mentioning users when followed by multiple periods (#8548) * MM-9868 Fixed mentioning users when followed by multiple periods * Added additional unit test * Added comment to clarify test purpose --- app/notification.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'app/notification.go') diff --git a/app/notification.go b/app/notification.go index 181ad4aac..6d0de2223 100644 --- a/app/notification.go +++ b/app/notification.go @@ -892,8 +892,17 @@ func GetExplicitMentions(message string, keywords map[string][]string) *Explicit } // remove trailing '.', as that is the end of a sentence - word = strings.TrimSuffix(word, ".") - if checkForMention(word) { + foundWithSuffix := false + + for strings.HasSuffix(word, ".") { + word = strings.TrimSuffix(word, ".") + if checkForMention(word) { + foundWithSuffix = true + break + } + } + + if foundWithSuffix { continue } -- cgit v1.2.3-1-g7c22