diff --git a/src/converse-core.js b/src/converse-core.js index 2859c88fa..c98092139 100755 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -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; diff --git a/src/converse-rosterview.js b/src/converse-rosterview.js index 25f940a07..e846d1683 100644 --- a/src/converse-rosterview.js +++ b/src/converse-rosterview.js @@ -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