From 3bdc0b527e388fe9a5d24fe43b61b083f6f88160 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Mon, 21 Feb 2022 13:27:28 -0500
Subject: [PATCH] conversationmodel: fix reloading for merge commits

if the cache is cleaned but not the latest interaction, when
reloading, if the lastMessageUid is a merge commit, it will
not reload until the latest interaction

https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/340

Change-Id: I91ade5b2e80957bb97fe711e95f2837330553b0e
---
 src/conversationmodel.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp
index a7102fd7..30d6ac02 100644
--- a/src/conversationmodel.cpp
+++ b/src/conversationmodel.cpp
@@ -1392,8 +1392,9 @@ ConversationModel::clearInteractionsCache(const QString& convId)
                 std::lock_guard<std::mutex> lk(pimpl_->interactionsLocks[convId]);
                 conversation.interactions->clear();
             }
-            ConfigurationManager::instance().loadConversationMessages(owner.id, convId, "", 1);
             conversation.allMessagesLoaded = false;
+            conversation.lastMessageUid = "";
+            ConfigurationManager::instance().loadConversationMessages(owner.id, convId, "", 1);
         }
     } catch (const std::out_of_range& e) {
         qDebug() << "can't find interaction from conversation: " << e.what();
-- 
GitLab