From c37ec740e281326809a4a3642e149978108a7bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Wed, 14 Jun 2023 11:22:16 -0400 Subject: [PATCH] misc: fix click on remove conversation https://git.jami.net/savoirfairelinux/jami-daemon/-/issues/855 Change-Id: I2c0caa3db05c663c5ee23367774c987aeca3324f --- .../components/ConversationSmartListContextMenu.qml | 2 +- src/libclient/conversationmodel.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/app/mainview/components/ConversationSmartListContextMenu.qml b/src/app/mainview/components/ConversationSmartListContextMenu.qml index 10b85a0d2..068cda26f 100644 --- a/src/app/mainview/components/ConversationSmartListContextMenu.qml +++ b/src/app/mainview/components/ConversationSmartListContextMenu.qml @@ -91,7 +91,7 @@ ContextMenuAutoLoader { "confirmLabel": JamiStrings.optionRemove }); dlg.accepted.connect(function () { - if (!isCoreDialog) + if (mode !== Conversation.Mode.NON_SWARM) MessagesAdapter.removeConversation(responsibleConvUid); else MessagesAdapter.removeContact(responsibleConvUid); diff --git a/src/libclient/conversationmodel.cpp b/src/libclient/conversationmodel.cpp index 34c588c14..d6c625704 100644 --- a/src/libclient/conversationmodel.cpp +++ b/src/libclient/conversationmodel.cpp @@ -832,12 +832,19 @@ ConversationModel::removeConversation(const QString& uid, bool banned) return; } if (conversation.isSwarm() && !banned && !conversation.isCoreDialog()) { - if (conversation.isRequest) + if (conversation.isRequest) { ConfigurationManager::instance().declineConversationRequest(owner.id, uid); - else + } else { ConfigurationManager::instance().removeConversation(owner.id, uid); + } } else { - owner.contactModel->removeContact(peers.front(), banned); + try { + auto& contact = owner.contactModel->getContact(peers.front()); + owner.contactModel->removeContact(peers.front(), banned); + } catch (const std::out_of_range&) { + qWarning() << "Contact not found: " << peers.front(); + ConfigurationManager::instance().removeConversation(owner.id, uid); + } } } -- GitLab