From 7de76924b409b25dcf0586b8e41e04f00309cd22 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 5 Jul 2016 06:21:25 +0000 Subject: [PATCH] Create the minimized_chats obj during `_initialization` and don't remove during `_tearDown`. Fixes bug in `trimChats` when logging in again and `converse.minimized_chats` is undefined. --- src/converse-minimize.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/converse-minimize.js b/src/converse-minimize.js index a2e9d7b0e..b0c31277e 100644 --- a/src/converse-minimize.js +++ b/src/converse-minimize.js @@ -32,22 +32,12 @@ // // New functions which don't exist yet can also be added. - _tearDown: function () { - this._super._tearDown.apply(this, arguments); - if (this.minimized_chats) { - this.minimized_chats.undelegateEvents().model.reset(); - this.minimized_chats.removeAll(); // Remove sub-views - this.minimized_chats.tearDown().remove(); // Remove overview - delete this.minimized_chats; - } - return this; - }, - - onConnected: function () { + _initialize: function () { + this._super._initialize.apply(this, arguments); converse.minimized_chats = new converse.MinimizedChats({ model: converse.chatboxes }); - return this._super.onConnected.apply(this, arguments); + return this; }, registerGlobalEventHandlers: function () {