Bugfix. Make sure _devices_promise
is a Promise
This commit is contained in:
parent
1c38863bfd
commit
affafc746c
29
dist/converse.js
vendored
29
dist/converse.js
vendored
|
@ -66192,23 +66192,28 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
|
||||||
|
|
||||||
fetchDevices() {
|
fetchDevices() {
|
||||||
if (_.isUndefined(this._devices_promise)) {
|
if (_.isUndefined(this._devices_promise)) {
|
||||||
const options = {
|
this._devices_promise = new Promise(resolve => {
|
||||||
'success': c => this.onCachedDevicesFetched(c),
|
this.devices.fetch({
|
||||||
'error': e => _converse.log(e, Strophe.LogLevel.ERROR)
|
'success': async collection => {
|
||||||
};
|
if (collection.length === 0) {
|
||||||
this._devices_promise = this.devices.fetch(options);
|
const ids = await this.fetchDevicesFromServer();
|
||||||
|
await this.publishCurrentDevice(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
'error': e => {
|
||||||
|
_converse.log(e, Strophe.LogLevel.ERROR);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._devices_promise;
|
return this._devices_promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
async onCachedDevicesFetched(collection) {
|
|
||||||
if (collection.length === 0) {
|
|
||||||
const ids = await this.fetchDevicesFromServer();
|
|
||||||
this.publishCurrentDevice(ids);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async publishCurrentDevice(device_ids) {
|
async publishCurrentDevice(device_ids) {
|
||||||
if (this.get('jid') !== _converse.bare_jid) {
|
if (this.get('jid') !== _converse.bare_jid) {
|
||||||
// We only publish for ourselves.
|
// We only publish for ourselves.
|
||||||
|
|
|
@ -840,22 +840,25 @@ converse.plugins.add('converse-omemo', {
|
||||||
|
|
||||||
fetchDevices () {
|
fetchDevices () {
|
||||||
if (_.isUndefined(this._devices_promise)) {
|
if (_.isUndefined(this._devices_promise)) {
|
||||||
const options = {
|
this._devices_promise = new Promise(resolve => {
|
||||||
'success': c => this.onCachedDevicesFetched(c),
|
this.devices.fetch({
|
||||||
'error': e => _converse.log(e, Strophe.LogLevel.ERROR)
|
'success': async collection => {
|
||||||
}
|
if (collection.length === 0) {
|
||||||
this._devices_promise = this.devices.fetch(options);
|
const ids = await this.fetchDevicesFromServer()
|
||||||
|
await this.publishCurrentDevice(ids);
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
},
|
||||||
|
'error': e => {
|
||||||
|
_converse.log(e, Strophe.LogLevel.ERROR);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return this._devices_promise;
|
return this._devices_promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
async onCachedDevicesFetched (collection) {
|
|
||||||
if (collection.length === 0) {
|
|
||||||
const ids = await this.fetchDevicesFromServer()
|
|
||||||
this.publishCurrentDevice(ids);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async publishCurrentDevice (device_ids) {
|
async publishCurrentDevice (device_ids) {
|
||||||
if (this.get('jid') !== _converse.bare_jid) {
|
if (this.get('jid') !== _converse.bare_jid) {
|
||||||
// We only publish for ourselves.
|
// We only publish for ourselves.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user