Skip to content

Commit

Permalink
feat: allow passing subset of user settings on update route
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Oct 28, 2020
1 parent 618e098 commit ec03af7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/api/users.js
Expand Up @@ -99,7 +99,11 @@ usersAPI.updateSettings = async function (caller, data) {
throw new Error('[[error:no-privileges]]');
}

return await user.saveSettings(data.uid, data.settings);
const current = await user.getSettings(data.uid);
const payload = { ...current, ...data.settings };
delete payload.uid;

return await user.saveSettings(data.uid, payload);
};

usersAPI.updateSetting = async function (caller, data) {
Expand Down

0 comments on commit ec03af7

Please sign in to comment.