Two trimChats bugfixes. See below.
- TrimChats was called before a newly maximized chat had its final width which prevented it from working as intended. - We cannot check for available space by using the width of the #conversejs element anymore, since it now has variable (auto) width. So we check against the body width instead.
This commit is contained in:
parent
f4edf75c72
commit
a77744d867
18
converse.js
18
converse.js
@ -1626,8 +1626,13 @@
|
||||
},
|
||||
|
||||
maximize: function () {
|
||||
var chatboxviews = converse.chatboxviews;
|
||||
// Restores a minimized chat box
|
||||
this.$el.insertAfter(converse.chatboxviews.get("controlbox").$el).show('fast', $.proxy(function () {
|
||||
this.$el.insertAfter(chatboxviews.get("controlbox").$el).show('fast', $.proxy(function () {
|
||||
/* Now that the chat box is visible, we can call trimChats
|
||||
* to make space available if need be.
|
||||
*/
|
||||
chatboxviews.trimChats(this);
|
||||
converse.refreshWebkit();
|
||||
this.setChatState(ACTIVE).focus();
|
||||
converse.emit('chatBoxMaximized', this);
|
||||
@ -3317,10 +3322,13 @@
|
||||
initialize: function () {
|
||||
this.model.on("add", this.onChatBoxAdded, this);
|
||||
this.model.on("change:minimized", function (item) {
|
||||
if (item.get('minimized') === false) {
|
||||
this.trimChats(this.get(item.get('id')));
|
||||
} else {
|
||||
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);
|
||||
},
|
||||
@ -3393,7 +3401,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
if ((minimized_width + boxes_width + controlbox_width) > this.$el.outerWidth(true)) {
|
||||
if ((minimized_width + boxes_width + controlbox_width) > $('body').outerWidth(true)) {
|
||||
oldest_chat = this.getOldestMaximizedChat();
|
||||
if (oldest_chat && oldest_chat.get('id') !== new_id) {
|
||||
oldest_chat.minimize();
|
||||
|
Loading…
Reference in New Issue
Block a user