mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 06:45:45 +02:00
conversationmodel: let the daemon manage the removal
Change-Id: I00e8fd2552aa1e08c03ef8e7dada4629ebdd619d
This commit is contained in:
parent
4a08775082
commit
d9432163f6
1 changed files with 9 additions and 7 deletions
|
@ -2580,25 +2580,27 @@ ConversationModelPimpl::slotConversationRemoved(const QString& accountId,
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeConversation();
|
||||||
|
|
||||||
if (conversation.mode == conversation::Mode::ONE_TO_ONE) {
|
if (conversation.mode == conversation::Mode::ONE_TO_ONE) {
|
||||||
removeConversation();
|
|
||||||
|
|
||||||
// If it's a 1:1 conversation and we don't have any more conversation
|
// If it's a 1:1 conversation and we don't have any more conversation
|
||||||
// we can remove the contact
|
// we can remove the contact
|
||||||
auto conv = storage::getConversationsWithPeer(db, contactUri);
|
auto contactRemoved = true;
|
||||||
if (conv.empty())
|
try {
|
||||||
linked.owner.contactModel->removeContact(contactUri, false);
|
auto& conv = getConversationForPeerUri(contactUri).get();
|
||||||
|
contactRemoved = !conv.isSwarm();
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
if (contact.isBanned && conv.empty()) {
|
if (contact.isBanned && contactRemoved) {
|
||||||
// Add 1:1 conv for banned
|
// Add 1:1 conv for banned
|
||||||
auto c = storage::beginConversationWithPeer(db, contactUri);
|
auto c = storage::beginConversationWithPeer(db, contactUri);
|
||||||
addConversationWith(c, contactUri, false);
|
addConversationWith(c, contactUri, false);
|
||||||
Q_EMIT linked.conversationReady(c, contactUri);
|
Q_EMIT linked.conversationReady(c, contactUri);
|
||||||
Q_EMIT linked.newConversation(c);
|
Q_EMIT linked.newConversation(c);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
removeConversation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
qWarning() << e.what();
|
qWarning() << e.what();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue