From 19d59d1126c21192405e0f46c03ecb422646f201 Mon Sep 17 00:00:00 2001 From: Doug Lauder Date: Thu, 11 Jul 2024 04:17:09 -0400 Subject: [PATCH] MM-58245 Don't allow patching real email or username for remote users (#27613) * don't allow patching real email or username for remote users * add comment --- server/platform/services/sharedchannel/sync_recv.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/platform/services/sharedchannel/sync_recv.go b/server/platform/services/sharedchannel/sync_recv.go index 5e7f172ec3..21db2f10c8 100644 --- a/server/platform/services/sharedchannel/sync_recv.go +++ b/server/platform/services/sharedchannel/sync_recv.go @@ -209,12 +209,15 @@ func (scs *Service) upsertSyncUser(c request.CTX, user *model.User, channel *mod ) return nil, fmt.Errorf("error updating user: %w", ErrRemoteIDMismatch) } + // save the updated username and email in props + user.SetProp(model.UserPropsKeyRemoteUsername, user.Username) + user.SetProp(model.UserPropsKeyRemoteEmail, user.Email) + // TODO: MM-59398: allow patching username with munged, unique name + patch := &model.UserPatch{ - Username: &user.Username, Nickname: &user.Nickname, FirstName: &user.FirstName, LastName: &user.LastName, - Email: &user.Email, Props: user.Props, Position: &user.Position, Locale: &user.Locale,