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'
This commit is contained in:
JC Brand 2016-03-09 10:25:31 +00:00
parent 7484259024
commit d893d9782a
2 changed files with 3 additions and 13 deletions

View File

@ -158,7 +158,7 @@
maximize: function () { maximize: function () {
var chatboxviews = converse.chatboxviews; var chatboxviews = converse.chatboxviews;
// Restores a minimized chat box // 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; return this;
} }
} }

View File

@ -2411,16 +2411,6 @@
initialize: function () { initialize: function () {
this.model.on("add", this.onChatBoxAdded, this); 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 () { _ensureElement: function () {
@ -2623,9 +2613,9 @@
render: function () { render: function () {
if (this.keys().length === 0) { 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) { } else if (this.keys().length === 1) {
this.$el.show('fast'); this.$el.show('fast', converse.chatboxviews.trimChats.bind(converse.chatboxviews));
} }
return this.$el; return this.$el;
}, },