Bläddra i källkod

Call trimChats in the show method of the box view

Not in the onAdded handler.
JC Brand 9 år sedan
förälder
incheckning
8b459c68b1
3 ändrade filer med 3 tillägg och 7 borttagningar
  1. 1 1
      src/converse-controlbox.js
  2. 2 5
      src/converse-core.js
  3. 0 1
      src/converse-muc.js

+ 1 - 1
src/converse-controlbox.js

@@ -85,7 +85,6 @@
                     if (!view && item.get('box_id') === 'controlbox') {
                         view = new converse.ControlBoxView({model: item});
                         this.add(item.get('id'), view);
-                        this.trimChats(view);
                     } else {
                         this._super.onChatBoxAdded.apply(this, arguments);
                     }
@@ -351,6 +350,7 @@
 
                 show: function () {
                     converse.controlboxtoggle.hide(function () {
+                        converse.chatboxviews.trimChats(this);
                         this.$el.show('fast', function () {
                             if (converse.rosterview) {
                                 converse.rosterview.update();

+ 2 - 5
src/converse-core.js

@@ -2261,18 +2261,16 @@
                     this.debouncedShow = _.debounce(function (focus) {
                         if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
                             if (focus) { this.focus(); }
-                            return this;
+                            return;
                         }
                         this.initDragResize().setDimensions();
-                        // We call trimChats before fading in, to avoid ugly transition
-                        // effects.
-                        converse.chatboxviews.trimChats(this);
                         this.$el.fadeIn(function () {
                             if (converse.connection.connected) {
                                 // Without a connection, we haven't yet initialized
                                 // localstorage
                                 this.model.save();
                             }
+                            converse.chatboxviews.trimChats(this);
                             this.setChatState(converse.ACTIVE);
                             this.scrollDown();
                             if (focus) {
@@ -2452,7 +2450,6 @@
                     view.model = item;
                     view.initialize();
                 }
-                this.trimChats(view);
             },
 
             getChatBoxWidth: function (view) {

+ 0 - 1
src/converse-muc.js

@@ -189,7 +189,6 @@
                     if (!view && item.get('chatroom')) {
                         view = new converse.ChatRoomView({'model': item});
                         this.add(item.get('id'), view);
-                        this.trimChats(view);
                     } else {
                         this._super.onChatBoxAdded.apply(this, arguments);
                     }