From 2feead169d79d8911f1eb866807bf43b9bde0dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Wed, 12 Jan 2022 15:10:54 -0500 Subject: [PATCH] conversationmodel: recompute lastDisplayed from daemon signals Change-Id: I628ce5a793e8fb8285c73e5a9f24dc2fc2e647f0 --- src/conversationmodel.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp index aa840d09..aaa897fd 100644 --- a/src/conversationmodel.cpp +++ b/src/conversationmodel.cpp @@ -3449,6 +3449,17 @@ ConversationModelPimpl::slotUpdateInteractionStatus(const QString& accountId, auto previous = conversation.interactions->getRead(peerId); if (peerId != linked.owner.profileInfo.uri) conversation.interactions->setRead(peerId, messageId); + else { + // Here, this means that the daemon synched the displayed message + // so, compute the number of unread messages. + conversation.unreadMessages = ConfigurationManager::instance() + .countInteractions(linked.owner.id, + conversationId, + messageId, + "", + peerId); + Q_EMIT linked.dataChanged(indexOf(conversationId)); + } emit linked.displayedInteractionChanged(conversationId, peerId, previous, messageId); } } -- GitLab