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

Remove unnecessary promise wrapper

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