From 428756e5680c04e22672b334c9c468245675c2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= Date: Tue, 7 Nov 2023 13:20:04 -0500 Subject: [PATCH] contactmodel: do not emit contactAdded for already added contact Change-Id: I226c804181e88b47d5d361d84caaf0db23e09e6c --- src/libclient/contactmodel.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/libclient/contactmodel.cpp b/src/libclient/contactmodel.cpp index 78893a496..9495a7576 100644 --- a/src/libclient/contactmodel.cpp +++ b/src/libclient/contactmodel.cpp @@ -810,8 +810,16 @@ ContactModelPimpl::slotContactAdded(const QString& accountId, const QString& con if (accountId != linked.owner.id) return; auto contact = contacts.find(contactUri); - if (contact != contacts.end() && contact->profileInfo.type == profile::Type::PENDING) - Q_EMIT behaviorController.trustRequestTreated(linked.owner.id, contactUri); + if (contact != contacts.end()) { + if (contact->isBanned) { + // Continue + } else if (contact->profileInfo.type == profile::Type::PENDING) { + Q_EMIT behaviorController.trustRequestTreated(linked.owner.id, contactUri); + // Continue + } else { + return; + } + } // for jams account we already have profile with avatar, use it to save to vCard bool isJamsAccount = !linked.owner.confProperties.managerUri.isEmpty();