Commit 8b459c68 authored by JC Brand's avatar JC Brand

Call trimChats in the show method of the box view

Not in the onAdded handler.
parent d192b349
...@@ -85,7 +85,6 @@ ...@@ -85,7 +85,6 @@
if (!view && item.get('box_id') === 'controlbox') { if (!view && item.get('box_id') === 'controlbox') {
view = new converse.ControlBoxView({model: item}); view = new converse.ControlBoxView({model: item});
this.add(item.get('id'), view); this.add(item.get('id'), view);
this.trimChats(view);
} else { } else {
this._super.onChatBoxAdded.apply(this, arguments); this._super.onChatBoxAdded.apply(this, arguments);
} }
...@@ -351,6 +350,7 @@ ...@@ -351,6 +350,7 @@
show: function () { show: function () {
converse.controlboxtoggle.hide(function () { converse.controlboxtoggle.hide(function () {
converse.chatboxviews.trimChats(this);
this.$el.show('fast', function () { this.$el.show('fast', function () {
if (converse.rosterview) { if (converse.rosterview) {
converse.rosterview.update(); converse.rosterview.update();
......
...@@ -2261,18 +2261,16 @@ ...@@ -2261,18 +2261,16 @@
this.debouncedShow = _.debounce(function (focus) { this.debouncedShow = _.debounce(function (focus) {
if (this.$el.is(':visible') && this.$el.css('opacity') === "1") { if (this.$el.is(':visible') && this.$el.css('opacity') === "1") {
if (focus) { this.focus(); } if (focus) { this.focus(); }
return this; return;
} }
this.initDragResize().setDimensions(); this.initDragResize().setDimensions();
// We call trimChats before fading in, to avoid ugly transition
// effects.
converse.chatboxviews.trimChats(this);
this.$el.fadeIn(function () { this.$el.fadeIn(function () {
if (converse.connection.connected) { if (converse.connection.connected) {
// Without a connection, we haven't yet initialized // Without a connection, we haven't yet initialized
// localstorage // localstorage
this.model.save(); this.model.save();
} }
converse.chatboxviews.trimChats(this);
this.setChatState(converse.ACTIVE); this.setChatState(converse.ACTIVE);
this.scrollDown(); this.scrollDown();
if (focus) { if (focus) {
...@@ -2452,7 +2450,6 @@ ...@@ -2452,7 +2450,6 @@
view.model = item; view.model = item;
view.initialize(); view.initialize();
} }
this.trimChats(view);
}, },
getChatBoxWidth: function (view) { getChatBoxWidth: function (view) {
......
...@@ -189,7 +189,6 @@ ...@@ -189,7 +189,6 @@
if (!view && item.get('chatroom')) { if (!view && item.get('chatroom')) {
view = new converse.ChatRoomView({'model': item}); view = new converse.ChatRoomView({'model': item});
this.add(item.get('id'), view); this.add(item.get('id'), view);
this.trimChats(view);
} else { } else {
this._super.onChatBoxAdded.apply(this, arguments); this._super.onChatBoxAdded.apply(this, arguments);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment