Fixed updating mention keys when a user's username changes (#2774)

This commit is contained in:
Harrison Healey
2016-04-25 08:20:45 -04:00
committed by Christopher Speller
parent f73daebb61
commit d8df66c00c
4 changed files with 47 additions and 13 deletions

View File

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