From 5e0c77fecc0c6d6cac28af2c5a54faf636862dc9 Mon Sep 17 00:00:00 2001 From: Grigory Vodyanov Date: Sun, 12 Jul 2026 23:40:16 +0200 Subject: [PATCH] fix: merging Signed-off-by: Grigory Vodyanov --- src/components/ContactsList.vue | 17 +- src/components/ContactsList/Merging.vue | 238 +++++++++---------- src/utils/mergeContacts.ts | 122 ++++++++++ tests/javascript/utils/mergeContacts.test.ts | 175 ++++++++++++++ 4 files changed, 427 insertions(+), 125 deletions(-) create mode 100644 src/utils/mergeContacts.ts create mode 100644 tests/javascript/utils/mergeContacts.test.ts diff --git a/src/components/ContactsList.vue b/src/components/ContactsList.vue index bf43f2258a..f3fa13f175 100644 --- a/src/components/ContactsList.vue +++ b/src/components/ContactsList.vue @@ -480,11 +480,18 @@ export default { }, async finishContactMerging(mergedContact) { - // After merging, we need to update the contact in the store - await this.$store.dispatch('fetchFullContact', { contact: mergedContact, forceReFetch: true }) - - this.unselectAllMultiSelected() - this.isMerging = false + try { + // After merging, we need to update the contact in the store + await this.$store.dispatch('fetchFullContact', { contact: mergedContact, forceReFetch: true }) + } catch (error) { + // The merge itself already succeeded on the server, so we must + // not leave the dialog stuck in a loading state if refreshing + // the merged contact fails. + console.error('Could not refresh the merged contact', error) + } finally { + this.unselectAllMultiSelected() + this.isMerging = false + } await this.$router.push({ name: 'root', diff --git a/src/components/ContactsList/Merging.vue b/src/components/ContactsList/Merging.vue index 8d2a75aaef..59cdcd6e6e 100644 --- a/src/components/ContactsList/Merging.vue +++ b/src/components/ContactsList/Merging.vue @@ -23,6 +23,11 @@ type="warning" :text="t('contacts', 'The selected contacts have conflicting information. Choose which information to keep')" /> + +
- + {{ t('contacts', 'Merge contacts') }}