Destroy devicelist if we can't fetch the devices for it.

Otherwise Converse will try to fetch the devices again and again upon
page refresh.
This commit is contained in:
JC Brand 2018-12-21 06:21:16 +01:00
parent 45ed506551
commit 98fee37a41
2 changed files with 24 additions and 4 deletions

16
dist/converse.js vendored
View File

@ -56981,7 +56981,19 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
this.devices.fetch({
'success': async collection => {
if (collection.length === 0) {
const ids = await this.fetchDevicesFromServer();
let ids;
try {
ids = await this.fetchDevicesFromServer();
} catch (e) {
_converse.log(`Could not fetch devices for ${this.get('jid')}`);
_converse.log(e, Strophe.LogLevel.ERROR);
this.destroy();
return resolve(e);
}
await this.publishCurrentDevice(ids);
}
@ -56990,7 +57002,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'error': e => {
_converse.log(e, Strophe.LogLevel.ERROR);
resolve();
resolve(e);
}
});
});

View File

@ -955,14 +955,22 @@ converse.plugins.add('converse-omemo', {
this.devices.fetch({
'success': async collection => {
if (collection.length === 0) {
const ids = await this.fetchDevicesFromServer()
let ids;
try {
ids = await this.fetchDevicesFromServer()
} catch (e) {
_converse.log(`Could not fetch devices for ${this.get('jid')}`);
_converse.log(e, Strophe.LogLevel.ERROR);
this.destroy();
return resolve(e);
}
await this.publishCurrentDevice(ids);
}
resolve();
},
'error': e => {
_converse.log(e, Strophe.LogLevel.ERROR);
resolve();
resolve(e);
}
});
});