fix(backend): Merge JSON updates
This commit is contained in:
parent
1b574f6806
commit
241ff30af0
1 changed files with 5 additions and 1 deletions
|
@ -868,7 +868,11 @@ UserModel.prototype.guardedUpdate = async function ({ body, user }) {
|
|||
*/
|
||||
for (const field of this.jsonFields) {
|
||||
if (typeof body[field] !== 'undefined') {
|
||||
if (typeof body[field] === 'object') data[field] = body[field]
|
||||
if (typeof body[field] === 'object')
|
||||
data[field] = {
|
||||
...this.clear[field],
|
||||
...body[field],
|
||||
}
|
||||
else log.warn(body, `Tried to set JDON field ${field} to a non-object`)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue