From b9e8a9a3da6ae4a5c76de872045ee501de16c62f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= <danxuliu@gmail.com>
Date: Fri, 3 Jan 2020 01:12:37 +0100
Subject: Force restoring the sidebar header contents on file changes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If the sidebar is opened in a different file during a call the sidebar
header contents may not be properly restored due to the order in which
the updates are handled, so it needs to be executed again when the
FileInfo has been set and it does not match the current conversation.

Otherwise the call view could be a child of the header instead of the
header actions, so if a call is started again "hidden-by-call" will be
set to the call view too, hiding it during the call.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
---
 src/FilesSidebarCallViewApp.vue | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

(limited to 'src/FilesSidebarCallViewApp.vue')

diff --git a/src/FilesSidebarCallViewApp.vue b/src/FilesSidebarCallViewApp.vue
index 99f188d47..ec43d3df1 100644
--- a/src/FilesSidebarCallViewApp.vue
+++ b/src/FilesSidebarCallViewApp.vue
@@ -109,6 +109,38 @@ export default {
 				this.restoreSidebarHeaderContents()
 			}
 		},
+
+		/**
+		 * Force restoring the sidebar header contents on file changes.
+		 *
+		 * If the sidebar is opened in a different file during a call the
+		 * sidebar header contents may not be properly restored due to the order
+		 * in which the updates are handled, so it needs to be executed again
+		 * when the FileInfo has been set and it does not match the current
+		 * conversation.
+		 *
+		 * @param {Object} fileInfo the watched FileInfo
+		 */
+		fileInfo: function(fileInfo) {
+			if (!fileInfo) {
+				return
+			}
+
+			if (this.isInFile) {
+				return
+			}
+
+			const headerAction = document.querySelector('.app-sidebar-header__action')
+			if (!headerAction) {
+				return
+			}
+
+			if (this.$el.parentElement === headerAction) {
+				return
+			}
+
+			this.restoreSidebarHeaderContents()
+		},
 	},
 
 	methods: {
-- 
cgit v1.2.3

