From fcf138731fe0a76655fcc9997d1fe066b93f1382 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Tue, 31 Jul 2018 14:11:49 -0400
Subject: [PATCH] conversationmodel: avoid list blinking when empty
 conversations

Change-Id: Ibd394f07f14936488922788235f88602f47657bf
Gitlab: #372
Reviewed-by: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
---
 src/conversationmodel.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp
index 2dcf2a87..a39ce0fc 100644
--- a/src/conversationmodel.cpp
+++ b/src/conversationmodel.cpp
@@ -1192,6 +1192,10 @@ ConversationModelPimpl::sortConversations()
             auto historyB = conversationB.interactions;
             // A or B is a new conversation (without CONTACT interaction)
             if (conversationA.uid.empty() || conversationB.uid.empty()) return conversationA.uid.empty();
+            if (historyA.empty() && historyB.empty()) {
+                // If no information to compare, sort by Ring ID
+                return conversationA.participants.front() > conversationB.participants.front();
+            }
             if (historyA.empty()) return false;
             if (historyB.empty()) return true;
             // Sort by last Interaction
-- 
GitLab