From 573bfd062d2c6cfeb390f41b28da68e055df857c Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Fri, 12 Jan 2024 22:22:57 +0700 Subject: [PATCH] UBERF-4908 Fix invalid contacts merge (#4347) Signed-off-by: Alexander Onnikov --- .../contact-resources/src/components/MergePersons.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/contact-resources/src/components/MergePersons.svelte b/plugins/contact-resources/src/components/MergePersons.svelte index 8622621e23..0a0716c674 100644 --- a/plugins/contact-resources/src/components/MergePersons.svelte +++ b/plugins/contact-resources/src/components/MergePersons.svelte @@ -101,14 +101,16 @@ async function merge (): Promise { if (sourcePerson === undefined || targetPerson === undefined) return + if (Object.keys(update).length > 0) { - if (update.avatar !== undefined || sourcePerson.avatar === targetPerson.avatar) { + const _update = { ...update } + if (_update.avatar !== undefined || sourcePerson.avatar === targetPerson.avatar) { // We replace avatar, we need to update source with target await client.update(sourcePerson, { avatar: sourcePerson.avatar === targetPerson.avatar ? '' : targetPerson.avatar }) } - await client.update(targetPerson, update) + await client.update(targetPerson, _update) } for (const channel of resultChannels.values()) { if (channel.attachedTo === targetPerson._id) continue