From d42fe78676d1cf1c8513bbb903449e027f7dccd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 20 Feb 2024 16:00:05 -0500 Subject: [PATCH] presence: fix presence status for swarm with multiple members Change-Id: Ic2e86b932c4805016689ffc41e4cede26b715954 --- src/app/conversationlistmodelbase.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/conversationlistmodelbase.cpp b/src/app/conversationlistmodelbase.cpp index 03f93a4fb..b8b772740 100644 --- a/src/app/conversationlistmodelbase.cpp +++ b/src/app/conversationlistmodelbase.cpp @@ -171,17 +171,19 @@ ConversationListModelBase::dataForItem(item_t item, int role) const return ret; } case Role::Presence: { - // The conversation can show a green dot if at least one peer is present + // A conversation presence is the max of the members presence + auto maxPresence = 0; Q_FOREACH (const auto& peerUri, model_->peersForConversation(item.uid)) try { auto& accInfo = lrcInstance_->getAccountInfo(accountId_); if (peerUri == accInfo.profileInfo.uri) return 2; // Self account auto contact = accInfo.contactModel->getContact(peerUri); - return contact.presence; + if (contact.presence > maxPresence) + maxPresence = contact.presence; } catch (const std::exception&) { } - return false; + return maxPresence; }; default: break; -- GitLab