Fix closing of controlbox without a connection being present
This commit is contained in:
parent
aa09ea58cd
commit
54554e94ed
17
converse.js
17
converse.js
@ -479,7 +479,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
closeChat: function () {
|
closeChat: function () {
|
||||||
this.model.destroy();
|
if (xmppchat.connection) {
|
||||||
|
this.model.destroy();
|
||||||
|
} else {
|
||||||
|
this.model.trigger('hide');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (){
|
initialize: function (){
|
||||||
@ -741,6 +745,9 @@
|
|||||||
this.model.on('destroy', $.proxy(function (model, response, options) {
|
this.model.on('destroy', $.proxy(function (model, response, options) {
|
||||||
this.$el.hide('fast');
|
this.$el.hide('fast');
|
||||||
}, this));
|
}, this));
|
||||||
|
this.model.on('hide', $.proxy(function (model, response, options) {
|
||||||
|
this.$el.hide('fast');
|
||||||
|
}, this));
|
||||||
|
|
||||||
if (this.model.get('visible')) {
|
if (this.model.get('visible')) {
|
||||||
this.show();
|
this.show();
|
||||||
@ -1875,10 +1882,14 @@
|
|||||||
|
|
||||||
$toggle.bind('click', $.proxy(function (e) {
|
$toggle.bind('click', $.proxy(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
var controlbox = this.chatboxes.get('controlbox');
|
||||||
if ($("div#controlbox").is(':visible')) {
|
if ($("div#controlbox").is(':visible')) {
|
||||||
this.chatboxes.get('controlbox').destroy();
|
if (this.connection) {
|
||||||
|
controlbox.destroy();
|
||||||
|
} else {
|
||||||
|
controlbox.trigger('hide');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var controlbox = this.chatboxes.get('controlbox');
|
|
||||||
if (!controlbox) {
|
if (!controlbox) {
|
||||||
controlbox = this.chatboxes.add({
|
controlbox = this.chatboxes.add({
|
||||||
id: 'controlbox',
|
id: 'controlbox',
|
||||||
|
Loading…
Reference in New Issue
Block a user