Commit 069d4a9f authored by JC Brand's avatar JC Brand

Remove unnecessary promise wrapper

updates #497
parent fd639e2d
...@@ -151,20 +151,15 @@ ...@@ -151,20 +151,15 @@
getBundlesAndBuildSessions () { getBundlesAndBuildSessions () {
const { _converse } = this.__super__; const { _converse } = this.__super__;
return new Promise((resolve, reject) => { let devices;
_converse.getDevicesForContact(this.get('jid')) return _converse.getDevicesForContact(this.get('jid'))
.then((their_devices) => { .then((their_devices) => {
const device_id = _converse.omemo_store.get('device_id'), const device_id = _converse.omemo_store.get('device_id'),
devicelist = _converse.devicelists.get(_converse.bare_jid), devicelist = _converse.devicelists.get(_converse.bare_jid),
own_devices = devicelist.devices.filter(device => device.get('id') !== device_id), own_devices = devicelist.devices.filter(device => device.get('id') !== device_id);
devices = _.concat(own_devices, their_devices.models); devices = _.concat(own_devices, their_devices.models);
return Promise.all(devices.map(device => device.getBundle()));
Promise.all(devices.map(device => device.getBundle())) }).then(() => this.buildSessions(devices))
.then(() => this.buildSessions(devices))
.then(() => resolve(devices))
.catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
});
}, },
buildSession (device) { buildSession (device) {
......
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