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
Этот коммит содержится в:
Harrison Healey
2018-04-02 12:40:28 -04:00
коммит произвёл GitHub
родитель cffb891854
Коммит 088f76ad6e
2 изменённых файлов: 50 добавлений и 2 удалений

Просмотреть файл

@@ -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
}