Commit 81fb2f44 authored by JC Brand's avatar JC Brand

Bugfix. Make sure roster is re-inserted after reconnection

parent f90ca8f7
...@@ -243,9 +243,7 @@ ...@@ -243,9 +243,7 @@
this.model.on('change:closed', this.ensureClosedState, this); this.model.on('change:closed', this.ensureClosedState, this);
this.render(); this.render();
if (this.model.get('connected')) { if (this.model.get('connected')) {
_converse.api.waitUntil('rosterViewInitialized') this.insertRoster();
.then(this.insertRoster.bind(this))
.catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
} }
_converse.emit('controlboxInitialized', this); _converse.emit('controlboxInitialized', this);
}, },
...@@ -277,19 +275,15 @@ ...@@ -277,19 +275,15 @@
onConnected () { onConnected () {
if (this.model.get('connected')) { if (this.model.get('connected')) {
this.render(); this.render();
_converse.api.waitUntil('rosterViewInitialized') this.insertRoster();
.then(this.insertRoster.bind(this))
.catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
} }
}, },
insertRoster () { insertRoster () {
/* Place the rosterview inside the "Contacts" panel. */ /* Place the rosterview inside the "Contacts" panel. */
this.controlbox_pane.el.insertAdjacentElement( _converse.api.waitUntil('rosterViewInitialized')
'beforeEnd', .then(() => this.controlbox_pane.el.insertAdjacentElement('beforeEnd', _converse.rosterview.el))
_converse.rosterview.el .catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
);
return this;
}, },
createBrandHeadingHTML () { createBrandHeadingHTML () {
...@@ -601,10 +595,11 @@ ...@@ -601,10 +595,11 @@
* to fetch the roster again and to send out a presence stanza. * to fetch the roster again and to send out a presence stanza.
*/ */
const view = _converse.chatboxviews.get('controlbox'); const view = _converse.chatboxviews.get('controlbox');
view.model.set({connected:false}); view.model.set({'connected': false});
view.renderLoginPanel(); view.renderLoginPanel();
}; };
_converse.on('disconnected', disconnect); _converse.on('disconnected', disconnect);
_converse.on('will-reconnect', disconnect);
} }
}); });
})); }));
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