From 987811a540769ca54d8e8752d8fa29b23a7da264 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Fri, 21 May 2021 14:42:26 -0400
Subject: [PATCH] conversationmodel: update call status' interaction

Change-Id: I6b5c3bb40a2b2986b0c378fc781e7e78a0e8873a
GitLab: #471
---
 src/conversationmodel.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/conversationmodel.cpp b/src/conversationmodel.cpp
index 1dc70f61..b1c8117a 100644
--- a/src/conversationmodel.cpp
+++ b/src/conversationmodel.cpp
@@ -1949,13 +1949,20 @@ ConversationModelPimpl::slotCallStatusChanged(const QString& callId, int code)
             for (auto& conversation : conversations) {
                 if (conversation.participants.front() == call.peerUri) {
                     conversation.callId = callId;
+                    // Update interaction status
                     invalidateModel();
                     emit linked.conversationUpdated(conversation.uid);
                     Q_EMIT linked.dataChanged(indexOf(conversation.uid));
                 }
             }
-        } else if (call.status == call::Status::PEER_BUSY) {
-            emit behaviorController.showLeaveMessageView(linked.owner.id, i->uid);
+        } else if (i != conversations.end()) {
+            if (call.status == call::Status::PEER_BUSY) {
+                emit behaviorController.showLeaveMessageView(linked.owner.id, i->uid);
+            }
+            // Update interaction status
+            invalidateModel();
+            emit linked.conversationUpdated(i->uid);
+            Q_EMIT linked.dataChanged(indexOf(i->uid));
         }
     } catch (std::out_of_range& e) {
         qDebug() << "ConversationModelPimpl::slotCallStatusChanged can't get inexistant call";
-- 
GitLab