Commit bd00bc4b authored by JC Brand's avatar JC Brand

muc-views: move event listeners further down

parent c4c7e419
...@@ -700,12 +700,8 @@ converse.plugins.add('converse-muc-views', { ...@@ -700,12 +700,8 @@ converse.plugins.add('converse-muc-views', {
this.removeAll(); this.removeAll();
}); });
this.listenTo(this.model.notifications, 'change', this.renderNotifications);
this.listenTo(this.model.session, 'change:connection_status', this.onConnectionStatusChanged); this.listenTo(this.model.session, 'change:connection_status', this.onConnectionStatusChanged);
const user_settings = await _converse.api.user.settings.getModel();
this.listenTo(user_settings, 'change:mucs_with_hidden_subject', this.renderHeading);
this.listenTo(this.model, 'change', debounce(() => this.renderHeading(), 250)); this.listenTo(this.model, 'change', debounce(() => this.renderHeading(), 250));
this.listenTo(this.model, 'change:hidden_occupants', this.updateOccupantsToggle); this.listenTo(this.model, 'change:hidden_occupants', this.updateOccupantsToggle);
this.listenTo(this.model, 'configurationNeeded', this.getAndRenderConfigurationForm); this.listenTo(this.model, 'configurationNeeded', this.getAndRenderConfigurationForm);
...@@ -726,10 +722,20 @@ converse.plugins.add('converse-muc-views', { ...@@ -726,10 +722,20 @@ converse.plugins.add('converse-muc-views', {
this.onMouseUp = this.onMouseUp.bind(this); this.onMouseUp = this.onMouseUp.bind(this);
await this.render(); await this.render();
// Needs to be registered after render has been called.
this.listenTo(this.model.notifications, 'change', this.renderNotifications);
this.createSidebarView(); this.createSidebarView();
await this.updateAfterMessagesFetched(); await this.updateAfterMessagesFetched();
// Register later due to await
const user_settings = await _converse.api.user.settings.getModel();
this.listenTo(user_settings, 'change:mucs_with_hidden_subject', this.renderHeading);
this.onConnectionStatusChanged(); this.onConnectionStatusChanged();
this.model.maybeShow(); this.model.maybeShow();
/** /**
* Triggered once a { @link _converse.ChatRoomView } has been opened * Triggered once a { @link _converse.ChatRoomView } has been opened
* @event _converse#chatRoomViewInitialized * @event _converse#chatRoomViewInitialized
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment