conversationmodel: fix isCoreDialog assumption

a one to one swarm is always a core dialog and should override all non swarm anyway.
Moreover, for the first interaction ever, the conversation's request can come
after. For example if alice calls bob, the call can come before the conversation's
request. The details of the contact will not link to any conversation leading
to a duplicate.

Change-Id: I7d68b2dee8ca2b42b12e22693388f7616c148d0a
GitLab: jami-client-qt#455
parent c84e76ca
......@@ -1977,19 +1977,8 @@ ConversationModelPimpl::isCoreDialog(const conversation::Info& conversation) con
{
switch (conversation.mode) {
case conversation::Mode::NON_SWARM:
return true;
case conversation::Mode::ONE_TO_ONE:
try {
// for active one-to-one conversation conversationId should be set
auto& peers = peersForConversation(conversation);
if (peers.size() != 1) {
return false;
}
auto contactInfo = linked.owner.contactModel->getContact(peers.front());
return !contactInfo.conversationId.isEmpty();
} catch (...) {
return true;
}
return true;
default:
break;
}
......@@ -2849,7 +2838,10 @@ ConversationModelPimpl::getConversationForPeerUri(const QString& uri,
if (!isCoreDialog(conv)) {
return false;
}
return uri == peersForConversation(conv).front();
auto members = peersForConversation(conv);
if (members.isEmpty())
return false;
return members.indexOf(uri) != -1;
},
searchResultIncluded);
}
......
Markdown is supported
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