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

conversationmodel: fix readOnly detection

This makes sense only in one to one. For swarm, there will be no
read only as we can add a new conversation member. Also, we should
not see readOnly = true for conversations with self.

Change-Id: Ic404a6b58e7812fedfe2fede91beb77b44436526
parent 2b10032d
......@@ -2760,7 +2760,7 @@ ConversationModelPimpl::addSwarmConversation(const QString& convId)
conversation.uid = convId;
conversation.accountId =;
QString lastRead;
VectorString membersRemaining;
VectorString membersLeft;
for (auto& member : members) {
// this check should be removed once all usage of participants replaced by
// peersForConversation. We should have ourself in participants list
......@@ -2772,10 +2772,10 @@ ConversationModelPimpl::addSwarmConversation(const QString& convId)
lastRead = member["lastDisplayed"];
conversation.lastDisplayedMessageUid.emplace(member["uri"], member["lastDisplayed"]);
if (member["role"] != "left")
if (member["role"] == "left")
conversation.readOnly = membersRemaining == VectorString(1, accountURI);
conversation.readOnly = mode == conversation::Mode::ONE_TO_ONE && membersLeft.size() == 1;
conversation.participants = participants;
conversation.mode = mode;
conversation.unreadMessages = ConfigurationManager::instance()
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