Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable17] Do not remove other event handlers when setting the active room #2230

Merged
merged 2 commits into from
Sep 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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