Skip to content

Commit

Permalink
Merge pull request #2230 from nextcloud/backport/2229/stable17
Browse files Browse the repository at this point in the history
[stable17] Do not remove other event handlers when setting the active room
  • Loading branch information
nickvergessen authored Sep 27, 2019
2 parents a40f0f7 + f6358b5 commit 2a0b2a3
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -376,9 +378,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);
Expand All @@ -390,6 +390,9 @@
self.updateSidebarWithActiveRoom();
});
},
_updatePageTitleOnDisplayNameChange: function(model, value) {
this.setPageTitle(value);
},
updateContentsLayout: function() {
if (!this.activeRoom) {
// This should never happen, but just in case
Expand Down

0 comments on commit 2a0b2a3

Please sign in to comment.