diff options
author | Asaad Mahmood <Unknowngi@live.com> | 2015-08-21 18:17:24 +0500 |
---|---|---|
committer | Asaad Mahmood <Unknowngi@live.com> | 2015-08-21 18:17:24 +0500 |
commit | 299bf056a584dd71cf0285b6ef1bbd596c07c0fe (patch) | |
tree | c1f32092efa1294c0a75d1e2f23154605ec8d001 /store | |
parent | afb09a1b9dd83e480a8c4f5744bd79cafb88a682 (diff) | |
parent | 4a022752faf9a2b6c4de5cfa65f23adb578a96a5 (diff) | |
download | chat-299bf056a584dd71cf0285b6ef1bbd596c07c0fe.tar.gz chat-299bf056a584dd71cf0285b6ef1bbd596c07c0fe.tar.bz2 chat-299bf056a584dd71cf0285b6ef1bbd596c07c0fe.zip |
Merge branch 'master' of https://github.com/mattermost/platform into mm-1696
Conflicts:
web/react/components/setting_upload.jsx
web/react/components/team_import_tab.jsx
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_user_store.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index cd25b488b..4b1189c2e 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -5,6 +5,7 @@ package store import ( "fmt" + "strings" "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" ) @@ -163,6 +164,17 @@ func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreCha user.EmailVerified = false } + 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 + } + if count, err := us.GetMaster().Update(user); err != nil { if IsUniqueConstraintError(err.Error(), "Email", "users_email_teamid_key") { result.Err = model.NewAppError("SqlUserStore.Update", "This email is already taken. Please choose another", "user_id="+user.Id+", "+err.Error()) |