Dont run fetchRosterContacts async, to prevent processing presence before contacts are created

Fixes #1405
This commit is contained in:
laszlovl 2019-02-11 17:26:42 +01:00 committed by JC Brand
parent 4a5603ab2e
commit b172861d2c
3 changed files with 19 additions and 11 deletions

View File

@ -7,6 +7,7 @@
- Accessibility: Tag the chat-content as an ARIA live region, for screen readers
- Set releases URL to new Github repo
- #1369 Don't wrongly interpret message with `subject` as a topic change.
- #1405 Status of contacts list are not displayed properly
- #1408 new config option `roomconfig_whitelist`
- #1412 muc moderator commands can be disabled selectively by config
- #1413 fix moderator commands that change affiliation

15
dist/converse.js vendored
View File

@ -68022,11 +68022,15 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
}
} else {
try {
await _converse.rostergroups.fetchRosterGroups().then(() => {
_converse.emit('rosterGroupsFetched');
/* Make sure not to run fetchRosterContacts async, since we need
* the contacts to exist before processing contacts presence,
* which might come in the same BOSH request.
*/
await _converse.rostergroups.fetchRosterGroups();
return _converse.roster.fetchRosterContacts();
});
_converse.emit('rosterGroupsFetched');
await _converse.roster.fetchRosterContacts();
_converse.emit('rosterContactsFetched');
} catch (reason) {
@ -68375,8 +68379,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
if (collection.length === 0 || this.rosterVersioningSupported() && !_converse.session.get('roster_fetched')) {
_converse.send_initial_presence = true;
_converse.roster.fetchFromServer();
await _converse.roster.fetchFromServer();
} else {
_converse.emit('cachedRoster', collection);
}

View File

@ -88,10 +88,14 @@ converse.plugins.add('converse-roster', {
}
} else {
try {
await _converse.rostergroups.fetchRosterGroups().then(() => {
_converse.emit('rosterGroupsFetched');
return _converse.roster.fetchRosterContacts();
});
/* Make sure not to run fetchRosterContacts async, since we need
* the contacts to exist before processing contacts presence,
* which might come in the same BOSH request.
*/
await _converse.rostergroups.fetchRosterGroups();
_converse.emit('rosterGroupsFetched');
await _converse.roster.fetchRosterContacts();
_converse.emit('rosterContactsFetched');
} catch (reason) {
_converse.log(reason, Strophe.LogLevel.ERROR);
@ -403,7 +407,7 @@ converse.plugins.add('converse-roster', {
if (collection.length === 0 ||
(this.rosterVersioningSupported() && !_converse.session.get('roster_fetched'))) {
_converse.send_initial_presence = true;
_converse.roster.fetchFromServer();
await _converse.roster.fetchFromServer();
} else {
_converse.emit('cachedRoster', collection);
}