[MM-28447] Avoid "ghost mentions" when "First Name" is not set, but "First Name trigger mention" setting is set (#15577)

* Do not add any keyword regarding first name if the first name is not set

* Add test

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Daniel Espino García
2020-09-24 19:01:14 +02:00
коммит произвёл GitHub
родитель c392f993d6
Коммит 9449d0e302
2 изменённых файлов: 19 добавлений и 1 удалений

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

@@ -873,7 +873,7 @@ func addMentionKeywordsForUser(keywords map[string][]string, profile *model.User
}
// If turned on, add the user's case sensitive first name
if profile.NotifyProps[model.FIRST_NAME_NOTIFY_PROP] == "true" {
if profile.NotifyProps[model.FIRST_NAME_NOTIFY_PROP] == "true" && profile.FirstName != "" {
keywords[profile.FirstName] = append(keywords[profile.FirstName], profile.Id)
}