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) {
if (typeof type === 'undefined') {
if (typeof type !== 'string') {
type = this.get('status') || 'online';
}
if (typeof status_message === 'undefined') {
if (typeof status_message !== 'string') {
status_message = this.get('status_message');
}
var presence;

View File

@ -153,6 +153,17 @@
});
}, 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 () {
if (this.$el.is(':visible')) { return this; }
this.$el.show();
@ -256,7 +267,7 @@
}
if (this.$roster.hasScrollBar()) {
this.filter_view.show();
} else {
} else if (!this.filter_view.isActive()) {
this.filter_view.hide();
}
return this;
@ -281,9 +292,7 @@
* fetching the roster we are ready to receive presence
* updates from our contacts.
*/
converse.roster.fetchFromServer(function () {
converse.xmppstatus.sendPresence();
});
converse.roster.fetchFromServer(converse.xmppstatus.sendPresence);
} else if (converse.send_initial_presence) {
/* We're not going to fetch the roster again because we have
* it already cached in sessionStorage, but we still need to