1
0
Fork 0

fix(backend): Merge JSON updates

This commit is contained in:
Joost De Cock 2023-08-20 16:03:54 +02:00
parent 1b574f6806
commit 241ff30af0

View file

@ -868,7 +868,11 @@ UserModel.prototype.guardedUpdate = async function ({ body, user }) {
*/ */
for (const field of this.jsonFields) { for (const field of this.jsonFields) {
if (typeof body[field] !== 'undefined') { 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`) else log.warn(body, `Tried to set JDON field ${field} to a non-object`)
} }
} }