Commit 1bc425e5 authored by JC Brand's avatar JC Brand

Fetch cached occupants in the model instead of the view

parent 69e8b071
...@@ -2036,20 +2036,16 @@ converse.plugins.add('converse-muc-views', { ...@@ -2036,20 +2036,16 @@ converse.plugins.add('converse-muc-views', {
ItemView: _converse.ChatRoomOccupantView, ItemView: _converse.ChatRoomOccupantView,
initialize () { async initialize () {
Backbone.OrderedListView.prototype.initialize.apply(this, arguments); Backbone.OrderedListView.prototype.initialize.apply(this, arguments);
this.chatroomview = this.model.chatroomview; this.chatroomview = this.model.chatroomview;
this.chatroomview.model.on('change:affiliation', this.renderInviteWidget, this); this.chatroomview.model.on('change:affiliation', this.renderInviteWidget, this);
this.chatroomview.model.features.on('change:open', this.renderInviteWidget, this); this.chatroomview.model.features.on('change:open', this.renderInviteWidget, this);
this.chatroomview.model.features.on('change', this.renderRoomFeatures, this); this.chatroomview.model.features.on('change', this.renderRoomFeatures, this);
this.render(); this.render();
this.model.fetch({ await this.model.fetched;
'add': true, this.sortAndPositionAllItems();
'silent': true,
'success': this.sortAndPositionAllItems.bind(this)
});
}, },
render () { render () {
......
...@@ -228,6 +228,15 @@ converse.plugins.add('converse-muc', { ...@@ -228,6 +228,15 @@ converse.plugins.add('converse-muc', {
`converse.occupants-${_converse.bare_jid}${this.get('jid')}` `converse.occupants-${_converse.bare_jid}${this.get('jid')}`
); );
this.occupants.chatroom = this; this.occupants.chatroom = this;
this.occupants.fetched = new Promise(resolve => {
this.fetch({
'add': true,
'silent': true,
'success': resolve,
'failure': resolve
});
});
this.registerHandlers(); this.registerHandlers();
}, },
......
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