Call trimChats in the show method of the box view

Not in the onAdded handler.
This commit is contained in:
JC Brand 2016-03-09 11:03:06 +00:00
parent d192b34919
commit 8b459c68b1
3 changed files with 3 additions and 7 deletions

View File

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

View File

@ -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) {

View File

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