MM-23211: Fix user not being notified in out of channel mentions (#14097)

Automatic Merge
Этот коммит содержится в:
Agniva De Sarker
2020-03-25 02:13:25 +05:30
коммит произвёл GitHub
родитель 6c6a64c103
Коммит 32b7f477bf
2 изменённых файлов: 73 добавлений и 55 удалений

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

@@ -829,6 +829,13 @@ func (m *ExplicitMentions) processText(text string, keywords map[string][]string
}
if _, ok := systemMentions[word]; !ok && strings.HasPrefix(word, "@") {
// No need to bother about unicode as we are looking for ASCII characters.
last := word[len(word)-1]
switch last {
// If the word is possibly at the end of a sentence, remove that character.
case '.', '-', ':':
word = word[:len(word)-1]
}
m.OtherPotentialMentions = append(m.OtherPotentialMentions, word[1:])
} else if strings.ContainsAny(word, ".-:") {
// This word contains a character that may be the end of a sentence, so split further