From 3855a5e951368671b57db8baa86f1207309d08b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Thu, 22 Feb 2024 15:38:37 -0500
Subject: [PATCH] chatview: fix footer visibility

Change-Id: I4bb6268547da6549a143da1d64b56f70cdd7dcc7
---
 src/app/mainview/components/ChatView.qml | 12 ++++--------
 tests/qml/src/tst_ChatView.qml           | 10 ++++++++++
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/app/mainview/components/ChatView.qml b/src/app/mainview/components/ChatView.qml
index 321419237..a25a8b6fb 100644
--- a/src/app/mainview/components/ChatView.qml
+++ b/src/app/mainview/components/ChatView.qml
@@ -21,7 +21,6 @@ import net.jami.Models 1.1
 import net.jami.Adapters 1.1
 import net.jami.Constants 1.1
 import net.jami.Enums 1.1
-
 import "../../commoncomponents"
 import "../js/pluginhandlerpickercreation.js" as PluginHandlerPickerCreation
 
@@ -135,7 +134,7 @@ Rectangle {
 
                 function onIdChanged() {
                     if (!chatViewHeader.interactionButtonsVisibility)
-                       extrasPanel.closePanel()
+                        extrasPanel.closePanel();
                 }
 
                 function onNeedsHost() {
@@ -251,14 +250,10 @@ Rectangle {
                     chatContents.visible = true;
                     return;
                 }
-
                 const isExpanding = width > previousWidth;
 
                 // Provide a detailed log here, as this function seems problematic.
-                console.debug("ChatViewSplitView.resolvePanes: f: %1 w: %2 pw: %3 epw: %4 pepw: %5 ie: %6"
-                              .arg(force).arg(width).arg(previousWidth)
-                              .arg(extrasPanelWidth).arg(previousExtrasPanelWidth).arg(isExpanding));
-
+                console.debug("ChatViewSplitView.resolvePanes: f: %1 w: %2 pw: %3 epw: %4 pepw: %5 ie: %6".arg(force).arg(width).arg(previousWidth).arg(extrasPanelWidth).arg(previousExtrasPanelWidth).arg(isExpanding));
                 const maximizePredicate = (!isExpanding || force) && chatContents.visible;
                 const minimizePredicate = (isExpanding || force) && !chatContents.visible;
                 const mainViewMinWidth = JamiTheme.mainViewPaneMinWidth;
@@ -323,6 +318,7 @@ Rectangle {
 
                 ChatViewFooter {
                     id: chatViewFooter
+                    objectName: "chatViewFooter"
 
                     visible: {
                         if (CurrentAccount.type === Profile.Type.SIP)
@@ -333,7 +329,7 @@ Rectangle {
                             return false;
                         else if (CurrentConversation.isRequest)
                             return false;
-                        return CurrentConversation.isSwarm;
+                        return CurrentConversation.isSwarm || CurrentConversation.isTemporary;
                     }
 
                     onHeightChanged: {
diff --git a/tests/qml/src/tst_ChatView.qml b/tests/qml/src/tst_ChatView.qml
index c10bafd37..b58af8c7e 100644
--- a/tests/qml/src/tst_ChatView.qml
+++ b/tests/qml/src/tst_ChatView.qml
@@ -49,6 +49,16 @@ ListSelectionView {
                 var sendContactRequestButton = findChild(chatviewHeader, "sendContactRequestButton")
                 compare(detailsButton.visible, true)
                 compare(sendContactRequestButton.visible, false)
+
+                var chatViewFooter = findChild(uut, "chatViewFooter")
+                CurrentConversation.isTemporary = true
+                compare(chatViewFooter.visible, true)
+                CurrentConversation.isTemporary = false
+                CurrentConversation.isRequest = true
+                compare(chatViewFooter.visible, false)
+                CurrentConversation.isRequest = false
+                CurrentConversation.needsSyncing = true
+                compare(chatViewFooter.visible, false)
             }
         }
     }
-- 
GitLab