Commit dc28cd5d authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conversationmodel: do not recreate non swarm conversation if removed

Change-Id: Ibc769db225bf9baa47b01b86c1eec4468b23786a
GitLab: #757
parent 357c814c
......@@ -821,7 +821,7 @@ ConversationModel::removeConversation(const QString& uid, bool banned)
ConfigurationManager::instance().removeConversation(, uid);
// Still some other conversation, do nothing else
if (!banned && getConversationForPeerUri(peers.front()) != std::nullopt)
if (!banned)
......@@ -2577,23 +2577,20 @@ ConversationModelPimpl::slotConversationRemoved(const QString& accountId,
auto& conversation = getConversationForUid(conversationId).get();
auto& peers = peersForConversation(conversation);
// if swarm conversation removed but we still have contact we create non swarm conversation.
// we should create non swarm conversation only for removed one-to-one conversation.
if (conversation.mode == conversation::Mode::ONE_TO_ONE) {
if (peers.isEmpty()) {
auto contactId = peers.first();
auto contactUri = peers.first();
auto conv = storage::getConversationsWithPeer(db, contactId);
if (conv.empty()) {
conv.push_back(storage::beginConversationWithPeer(db, contactId));
addConversationWith(conv[0], contactId, false);
Q_EMIT linked.newConversation(conv[0]);
// If it's a 1:1 conversation and we don't have any more conversation
// we can remove the contact
auto conv = storage::getConversationsWithPeer(db, contactUri);
if (conv.empty())
linked.owner.contactModel->removeContact(contactUri, true);
} else {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment