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 @@
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();
......
......@@ -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) {
......
......@@ -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);
}
......
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