mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixed updating mention keys when a user's username changes (#2774)
This commit is contained in:
committed by
Christopher Speller
parent
f73daebb61
commit
d8df66c00c
@@ -141,14 +141,7 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha
|
||||
}
|
||||
|
||||
if user.Username != oldUser.Username {
|
||||
nonUsernameKeys := []string{}
|
||||
splitKeys := strings.Split(user.NotifyProps["mention_keys"], ",")
|
||||
for _, key := range splitKeys {
|
||||
if key != oldUser.Username && key != "@"+oldUser.Username {
|
||||
nonUsernameKeys = append(nonUsernameKeys, key)
|
||||
}
|
||||
}
|
||||
user.NotifyProps["mention_keys"] = strings.Join(nonUsernameKeys, ",") + "," + user.Username + ",@" + user.Username
|
||||
user.UpdateMentionKeysFromUsername(oldUser.Username)
|
||||
}
|
||||
|
||||
if count, err := us.GetMaster().Update(user); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user