Skip to content
Snippets Groups Projects
Unverified Commit 48f1bd0d authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conversationlistmodelbase: add presences for swarm

If one contact is present in a conversation, the smartlist should
show a green dot.

GitLab: #670
Change-Id: I1608279e7f91d37c30343cc1d78824f6aa7bda8f
parent a5cfffef
No related branches found
No related tags found
No related merge requests found
......@@ -144,6 +144,18 @@ ConversationListModelBase::dataForItem(item_t item, int role) const
}
case Role::ReadOnly:
return QVariant(item.readOnly);
case Role::Presence: {
// The conversation can show a green dot if at least one peer is present
Q_FOREACH (const auto& peerUri, model_->peersForConversation(item.uid))
try {
auto& accInfo = lrcInstance_->getCurrentAccountInfo();
auto contact = accInfo.contactModel->getContact(peerUri);
if (contact.isPresent)
return true;
} catch (const std::exception&) {
}
return false;
};
default:
break;
}
......@@ -167,8 +179,6 @@ ConversationListModelBase::dataForItem(item_t item, int role) const
switch (role) {
case Role::BestId:
return QVariant(contactModel->bestIdForContact(peerUri));
case Role::Presence:
return QVariant(contact.isPresent);
case Role::Alias:
return QVariant(contact.profileInfo.alias);
case Role::RegisteredName:
......
......@@ -83,8 +83,8 @@ Rectangle {
newHm = Array.from(newHm).filter(r => r.convId !== convId)
}
// We can't have more than 8 participants yet.
if (newHm.length > 8) {
// We can't have more than 8 participants yet. (7 + self)
if (newHm.length > 7) {
return false
}
......@@ -308,7 +308,7 @@ Rectangle {
text: {
if (highlightedMembers.length === 0)
return JamiStrings.youCanAdd8
return JamiStrings.youCanAddMore.arg(8 - Math.min(highlightedMembers.length, 8))
return JamiStrings.youCanAddMore.arg(7 - Math.min(highlightedMembers.length, 7))
}
color: JamiTheme.textColor
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment