Browse Source

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.
JC Brand 9 years ago
parent
commit
7de76924b4
1 changed files with 3 additions and 13 deletions
  1. 3 13
      src/converse-minimize.js

+ 3 - 13
src/converse-minimize.js

@@ -32,22 +32,12 @@
             //
             //
             // New functions which don't exist yet can also be added.
             // 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({
                 converse.minimized_chats = new converse.MinimizedChats({
                     model: converse.chatboxes
                     model: converse.chatboxes
                 });
                 });
-                return this._super.onConnected.apply(this, arguments);
+                return this;
             },
             },
 
 
             registerGlobalEventHandlers: function () {
             registerGlobalEventHandlers: function () {