Commit d893d978 authored by JC Brand's avatar JC Brand

Improvement in when trimChats gets called

Don't call trimChats when the box is minimized or maximized, instead call it
only when the minimized chats toggle appears or disappears, since that's the
element that adds/removes space.

Also, a fix. 'onShow' has been renamed to 'onMaximized'
parent 74842590
......@@ -158,7 +158,7 @@
maximize: function () {
var chatboxviews = converse.chatboxviews;
// Restores a minimized chat box
this.$el.insertAfter(chatboxviews.get("controlbox").$el).show('fast', this.onShow.bind(this));
this.$el.insertAfter(chatboxviews.get("controlbox").$el).show('fast', this.onMaximized.bind(this));
return this;
}
}
......
......@@ -2411,16 +2411,6 @@
initialize: function () {
this.model.on("add", this.onChatBoxAdded, this);
this.model.on("change:minimized", function (item) {
if (item.get('minimized') === true) {
/* When a chat is minimized in trimChats, trimChats needs to be
* called again (in case the minimized chats toggle is newly shown).
*/
this.trimChats();
} else {
this.trimChats(this.get(item.get('id')));
}
}, this);
},
_ensureElement: function () {
......@@ -2623,9 +2613,9 @@
render: function () {
if (this.keys().length === 0) {
this.$el.hide('fast');
this.$el.hide('fast', converse.chatboxviews.trimChats.bind(converse.chatboxviews));
} else if (this.keys().length === 1) {
this.$el.show('fast');
this.$el.show('fast', converse.chatboxviews.trimChats.bind(converse.chatboxviews));
}
return this.$el;
},
......
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