Ensure consistent behavior from `show_controlbox_by_default`

This commit is contained in:
JC Brand 2017-02-14 17:23:22 +00:00
parent e52a775430
commit fbdbea223d
2 changed files with 9 additions and 6 deletions

View File

@ -22,6 +22,7 @@
## 2.0.7 (2017-02-14)
- Bugfix. 'TypeError: this.sendConfiguration(...).then is not a function' when an instant room is created. [jcbrand]
- Ensure consistent behavior from `show_controlbox_by_default` [jcbrand]
## 2.0.6 (2017-02-13)
- Escape user-generated input to prevent JS-injection attacks. (Thanks to SamWhited) [jcbrand]

View File

@ -134,10 +134,11 @@
closeAllChatBoxes: function () {
var _converse = this.__super__._converse;
this.each(function (view) {
if (_converse.disconnection_cause === _converse.LOGOUT ||
view.model.get('id') !== 'controlbox') {
view.close();
if (view.model.get('id') === 'controlbox' &&
(_converse.disconnection_cause !== _converse.LOGOUT || _converse.show_controlbox_by_default)) {
return;
}
view.close();
});
return this;
},
@ -244,9 +245,9 @@
this.render();
if (this.model.get('connected')) {
this.insertRoster();
}
if (_.isUndefined(this.model.get('closed'))) {
this.model.set('closed', !_converse.show_controlbox_by_default);
if (_.isUndefined(this.model.get('closed'))) {
this.model.set('closed', !_converse.show_controlbox_by_default);
}
}
if (!this.model.get('closed')) {
this.show();
@ -272,6 +273,7 @@
onConnected: function () {
if (this.model.get('connected')) {
this.render().insertRoster();
this.model.save('closed', !this.$el.is(':visible'));
}
},