Commit aa30e4d9 authored by JC Brand's avatar JC Brand

Bugfix. Don't unnecessarily fetch roster again when it's empty

parent e20b6548
...@@ -469,11 +469,7 @@ converse.plugins.add('converse-roster', { ...@@ -469,11 +469,7 @@ converse.plugins.add('converse-roster', {
} catch (e) { } catch (e) {
return _converse.log(e, Strophe.LogLevel.ERROR); return _converse.log(e, Strophe.LogLevel.ERROR);
} }
if (collection.length === 0 || if (collection.length || (this.rosterVersioningSupported() && _converse.session.get('roster_fetched'))) {
(this.rosterVersioningSupported() && !_converse.session.get('roster_fetched'))) {
_converse.send_initial_presence = true;
return _converse.roster.fetchFromServer();
} else {
/** /**
* The contacts roster has been retrieved from the local cache (`sessionStorage`). * The contacts roster has been retrieved from the local cache (`sessionStorage`).
* @event _converse#cachedRoster * @event _converse#cachedRoster
...@@ -482,6 +478,9 @@ converse.plugins.add('converse-roster', { ...@@ -482,6 +478,9 @@ converse.plugins.add('converse-roster', {
* @example _converse.api.waitUntil('cachedRoster').then(items => { ... }); * @example _converse.api.waitUntil('cachedRoster').then(items => { ... });
*/ */
_converse.api.trigger('cachedRoster', collection); _converse.api.trigger('cachedRoster', collection);
} else {
_converse.send_initial_presence = true;
return _converse.roster.fetchFromServer();
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment