mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
UBERF-4908 Fix invalid contacts merge (#4347)
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
parent
3ac0e6e259
commit
573bfd062d
@ -101,14 +101,16 @@
|
|||||||
|
|
||||||
async function merge (): Promise<void> {
|
async function merge (): Promise<void> {
|
||||||
if (sourcePerson === undefined || targetPerson === undefined) return
|
if (sourcePerson === undefined || targetPerson === undefined) return
|
||||||
|
|
||||||
if (Object.keys(update).length > 0) {
|
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
|
// We replace avatar, we need to update source with target
|
||||||
await client.update(sourcePerson, {
|
await client.update(sourcePerson, {
|
||||||
avatar: sourcePerson.avatar === targetPerson.avatar ? '' : targetPerson.avatar
|
avatar: sourcePerson.avatar === targetPerson.avatar ? '' : targetPerson.avatar
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await client.update(targetPerson, update)
|
await client.update(targetPerson, _update)
|
||||||
}
|
}
|
||||||
for (const channel of resultChannels.values()) {
|
for (const channel of resultChannels.values()) {
|
||||||
if (channel.attachedTo === targetPerson._id) continue
|
if (channel.attachedTo === targetPerson._id) continue
|
||||||
|
Loading…
Reference in New Issue
Block a user