Split showChat into two methods to allow easier overriding.

This commit is contained in:
JC Brand 2016-06-06 07:49:44 +00:00
parent 600650a4c7
commit eb3252542e

View File

@ -1398,10 +1398,7 @@
return this.model.chatBoxMayBeShown(chatbox);
},
showChat: function (attrs) {
/* Find the chat box and show it (if it may be shown).
* If it doesn't exist, create it.
*/
getChatBox: function (attrs) {
var chatbox = this.model.get(attrs.jid);
if (!chatbox) {
chatbox = this.model.create(attrs, {
@ -1410,6 +1407,14 @@
}
});
}
return chatbox;
},
showChat: function (attrs) {
/* Find the chat box and show it (if it may be shown).
* If it doesn't exist, create it.
*/
var chatbox = this.getChatBox(attrs);
if (this.chatBoxMayBeShown(chatbox)) {
chatbox.trigger('show', true);
}