controlbox: Only render the contacts panel when connected

Otherwise it gets rendered multiple times (at least during testing).
This commit is contained in:
JC Brand 2017-05-16 11:54:20 +02:00
parent 8fe7fd2ec2
commit 7c9475e9fc

View File

@ -242,14 +242,17 @@
} else { } else {
this.hide(); this.hide();
} }
this.$el.html(tpl_controlbox( this.el.innerHTML = tpl_controlbox(
_.extend(this.model.toJSON(), { _.extend(this.model.toJSON(), {
sticky_controlbox: _converse.sticky_controlbox 'sticky_controlbox': _converse.sticky_controlbox
})) }));
);
if (!_converse.connection.connected || !_converse.connection.authenticated || _converse.connection.disconnecting) { if (!_converse.connection.connected ||
!_converse.connection.authenticated ||
_converse.connection.disconnecting) {
this.renderLoginPanel(); this.renderLoginPanel();
} else if (!this.contactspanel || !this.contactspanel.$el.is(':visible')) { } else if (this.model.get('connected') &&
(!this.contactspanel || !this.contactspanel.$el.is(':visible'))) {
this.renderContactsPanel(); this.renderContactsPanel();
} }
return this; return this;