Move some close logic to the model

This commit is contained in:
JC Brand 2019-05-18 06:59:50 +02:00
parent 0426898c23
commit 84bde6e766
2 changed files with 9 additions and 5 deletions

View File

@ -1218,11 +1218,7 @@ converse.plugins.add('converse-chatview', {
this.setChatState(_converse.INACTIVE);
this.model.sendChatState();
}
try {
this.model.destroy();
} catch (e) {
_converse.log(e, Strophe.LogLevel.ERROR);
}
this.model.close();
this.remove();
/**
* Triggered once a chatbox has been closed.

View File

@ -325,6 +325,14 @@ converse.plugins.add('converse-chatboxes', {
});
},
close () {
try {
this.destroy();
} catch (e) {
_converse.log(e, Strophe.LogLevel.ERROR);
}
},
validate (attrs, options) {
const { _converse } = this.__super__;
if (!attrs.jid) {