Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #24362 #24566

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions server/channels/app/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,8 @@ func (a *App) UpdateUser(c request.CTX, user *model.User, sendNotifications bool
}(user.Id)
}

newUser.Sanitize(map[string]bool{})

return newUser, nil
}

Expand Down
4 changes: 3 additions & 1 deletion server/channels/app/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func TestUpdateUser(t *testing.T) {
require.Nil(t, err)
require.NotNil(t, u)
require.Less(t, u.LastPictureUpdate, iLastPictureUpdate)
require.Empty(t, u.Password)
})

t.Run("fails if profile picture is updated when user has custom profile picture and username is changed", func(t *testing.T) {
Expand Down Expand Up @@ -1731,11 +1732,12 @@ func TestPatchUser(t *testing.T) {
})

t.Run("Patch username with a new username", func(t *testing.T) {
_, err := th.App.PatchUser(th.Context, testUser.Id, &model.UserPatch{
u, err := th.App.PatchUser(th.Context, testUser.Id, &model.UserPatch{
Username: model.NewString(model.NewId()),
}, true)

require.Nil(t, err)
require.Empty(t, u.Password)
})
}

Expand Down