mirror of
https://github.com/outline/outline.git
synced 2026-12-05 02:44:34 +03:00
fix: Preserve existing values when optional update fields are omitted (#14344)
* fix: Preserve existing values when optional update fields are omitted * chore: Rename setDefined to fill * chore: Use fill in users.update and teamUpdater
This commit is contained in:
1 parent
ce439c893c
commit
9fe0c7ba2b
18 files changed
+275
-136
No files matched your search
@@ -287,28 +287,24 @@ router.post(
|
||||
authorize(actor, "update", user);
|
||||
const includeDetails = !!can(actor, "readDetails", user);
|
||||
|
||||
if (name) {
|
||||
user.name = name;
|
||||
}
|
||||
if (avatarUrl !== undefined) {
|
||||
user.avatarUrl = avatarUrl;
|
||||
user.fill({
|
||||
name: name || undefined,
|
||||
avatarUrl,
|
||||
language: language || undefined,
|
||||
timezone: timezone || undefined,
|
||||
});
|
||||
|
||||
// Mark that the user has manually changed their avatar
|
||||
// This prevents automatic syncing from identity providers
|
||||
// Mark that the user has manually changed their avatar
|
||||
// This prevents automatic syncing from identity providers
|
||||
if (avatarUrl !== undefined) {
|
||||
user.setFlag(UserFlag.AvatarUpdated, avatarUrl ? true : false);
|
||||
}
|
||||
if (language) {
|
||||
user.language = language;
|
||||
}
|
||||
if (preferences) {
|
||||
user.preferences = {
|
||||
...user.preferences,
|
||||
...preferences,
|
||||
};
|
||||
}
|
||||
if (timezone) {
|
||||
user.timezone = timezone;
|
||||
}
|
||||
|
||||
await user.saveWithCtx(ctx);
|
||||
|
||||
|
||||
Reference in new issue
Block a user