From fb5b88f32e1423c33b6c2a7d7896c479f8a77141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 26 Sep 2019 15:15:28 +0200 Subject: [PATCH 1/2] Extract handler to update the page title on display name change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Calviño Sánchez --- js/app.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/app.js b/js/app.js index c204d53bf5a..e758a5ad4b1 100644 --- a/js/app.js +++ b/js/app.js @@ -376,9 +376,7 @@ self._emptyContentView.setActiveRoom(self.activeRoom); self.setPageTitle(self.activeRoom.get('displayName')); - self.listenTo(self.activeRoom, 'change:displayName', function(model, value) { - self.setPageTitle(value); - }); + self.listenTo(self.activeRoom, 'change:displayName', self._updatePageTitleOnDisplayNameChange); self.updateContentsLayout(); self.listenTo(self.activeRoom, 'change:participantFlags', self.updateContentsLayout); @@ -390,6 +388,9 @@ self.updateSidebarWithActiveRoom(); }); }, + _updatePageTitleOnDisplayNameChange: function(model, value) { + this.setPageTitle(value); + }, updateContentsLayout: function() { if (!this.activeRoom) { // This should never happen, but just in case From f6358b5ffc7dccaeb72e22f6c43ebf05d8d27baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 26 Sep 2019 15:18:39 +0200 Subject: [PATCH 2/2] Do not remove other event handlers when setting the active room MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Besides being more correct, this also fixes the participant list not shown for guest moderators, as the handler for "change:participantType" events that shows and hides it in the public page is set during the UI initialization, but it was removed when joining the room. Signed-off-by: Daniel Calviño Sánchez --- js/app.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/app.js b/js/app.js index e758a5ad4b1..5df4d176eb3 100644 --- a/js/app.js +++ b/js/app.js @@ -358,10 +358,12 @@ var self = this; this.signaling.syncRooms() .then(function() { - self.stopListening(self.activeRoom, 'change:displayName'); - self.stopListening(self.activeRoom, 'change:participantType'); - self.stopListening(self.activeRoom, 'change:participantFlags'); - self.stopListening(self.activeRoom, 'change:lobbyState'); + self.stopListening(self.activeRoom, 'change:displayName', self._updatePageTitleOnDisplayNameChange); + self.stopListening(self.activeRoom, 'change:participantFlags', self.updateContentsLayout); + self.stopListening(self.activeRoom, 'change:participantType', self.updateContentsLayout); + self.stopListening(self.activeRoom, 'change:participantType', self._updateSidebar); + self.stopListening(self.activeRoom, 'change:lobbyState', self.updateContentsLayout); + self.stopListening(self.activeRoom, 'change:lobbyState', self._updateSidebar); if (OC.getCurrentUser().uid) { roomChannel.trigger('active', token);