Make sure we have a device to publish before doing so
This commit is contained in:
parent
94a1852b4f
commit
029fb6d60b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## 4.0.3 (Unreleased)
|
## 4.0.3 (Unreleased)
|
||||||
|
|
||||||
|
- Bugfix. Converse continuously publishes an empty OMEMO devicelist for itself
|
||||||
- Bugfix. Handler not triggered when submitting MUC password form 2nd time
|
- Bugfix. Handler not triggered when submitting MUC password form 2nd time
|
||||||
- Bugfix. MUC features weren't being refreshed when saving the config form
|
- Bugfix. MUC features weren't being refreshed when saving the config form
|
||||||
- Don't show duplicate notification messages
|
- Don't show duplicate notification messages
|
||||||
|
@ -855,8 +855,7 @@
|
|||||||
if (collection.length === 0) {
|
if (collection.length === 0) {
|
||||||
this.fetchDevicesFromServer()
|
this.fetchDevicesFromServer()
|
||||||
.then(ids => this.publishCurrentDevice(ids))
|
.then(ids => this.publishCurrentDevice(ids))
|
||||||
.then(resolve)
|
.finally(resolve)
|
||||||
.catch(resolve);
|
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
@ -867,20 +866,21 @@
|
|||||||
return this._devices_promise;
|
return this._devices_promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
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.
|
||||||
return Promise.resolve();
|
return
|
||||||
|
}
|
||||||
|
await restoreOMEMOSession();
|
||||||
|
let device_id = _converse.omemo_store.get('device_id');
|
||||||
|
if (!this.devices.findWhere({'id': device_id})) {
|
||||||
|
// Generate a new bundle if we cannot find our device
|
||||||
|
await _converse.omemo_store.generateBundle();
|
||||||
|
device_id = _converse.omemo_store.get('device_id');
|
||||||
}
|
}
|
||||||
return restoreOMEMOSession()
|
|
||||||
.then(() => {
|
|
||||||
const device_id = _converse.omemo_store.get('device_id'),
|
|
||||||
own_device = this.devices.findWhere({'id': device_id});
|
|
||||||
|
|
||||||
if (!_.includes(device_ids, device_id)) {
|
if (!_.includes(device_ids, device_id)) {
|
||||||
return this.publishDevices();
|
return this.publishDevices();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchDevicesFromServer () {
|
fetchDevicesFromServer () {
|
||||||
|
Loading…
Reference in New Issue
Block a user