Commit 98fee37a authored by JC Brand's avatar JC Brand

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.
parent 45ed5065
......@@ -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);
}
});
});
......@@ -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);
}
});
});
......
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