Bugfix. Don't hide the roster filter when it's actually being used

The filter was being hidden if the roster was not big enough to require a
scrollbar, but the roster might not be big enough because the roster is
actually being applied.
This commit is contained in:
JC Brand 2016-05-24 07:58:54 +00:00
parent d005fe3f7a
commit 0d2e49a976
2 changed files with 15 additions and 6 deletions

View File

@ -1438,10 +1438,10 @@
}, },
constructPresence: function (type, status_message) { constructPresence: function (type, status_message) {
if (typeof type === 'undefined') { if (typeof type !== 'string') {
type = this.get('status') || 'online'; type = this.get('status') || 'online';
} }
if (typeof status_message === 'undefined') { if (typeof status_message !== 'string') {
status_message = this.get('status_message'); status_message = this.get('status_message');
} }
var presence; var presence;

View File

@ -153,6 +153,17 @@
}); });
}, 250), }, 250),
isActive: function () {
/* Returns true if the filter is enabled (i.e. if the user
* has added values to the filter).
*/
if (this.model.get('filter_type') === 'state' ||
this.model.get('filter_text')) {
return true;
}
return false;
},
show: function () { show: function () {
if (this.$el.is(':visible')) { return this; } if (this.$el.is(':visible')) { return this; }
this.$el.show(); this.$el.show();
@ -256,7 +267,7 @@
} }
if (this.$roster.hasScrollBar()) { if (this.$roster.hasScrollBar()) {
this.filter_view.show(); this.filter_view.show();
} else { } else if (!this.filter_view.isActive()) {
this.filter_view.hide(); this.filter_view.hide();
} }
return this; return this;
@ -281,9 +292,7 @@
* fetching the roster we are ready to receive presence * fetching the roster we are ready to receive presence
* updates from our contacts. * updates from our contacts.
*/ */
converse.roster.fetchFromServer(function () { converse.roster.fetchFromServer(converse.xmppstatus.sendPresence);
converse.xmppstatus.sendPresence();
});
} else if (converse.send_initial_presence) { } else if (converse.send_initial_presence) {
/* We're not going to fetch the roster again because we have /* We're not going to fetch the roster again because we have
* it already cached in sessionStorage, but we still need to * it already cached in sessionStorage, but we still need to