Commit 9e56858a authored by JC Brand's avatar JC Brand

Remove unnecessary promise wrapper

parent 7bb7f8f4
...@@ -258,13 +258,9 @@ ...@@ -258,13 +258,9 @@
getEncryptionAttributesfromStanza (stanza, original_stanza, attrs) { getEncryptionAttributesfromStanza (stanza, original_stanza, attrs) {
const { _converse } = this.__super__, const { _converse } = this.__super__,
encrypted = sizzle(`encrypted[xmlns="${Strophe.NS.OMEMO}"]`, original_stanza).pop(); encrypted = sizzle(`encrypted[xmlns="${Strophe.NS.OMEMO}"]`, original_stanza).pop(),
return new Promise((resolve, reject) => {
const { _converse } = this.__super__,
header = encrypted.querySelector('header'), header = encrypted.querySelector('header'),
key = sizzle(`key[rid="${_converse.omemo_store.get('device_id')}"]`, encrypted).pop(); key = sizzle(`key[rid="${_converse.omemo_store.get('device_id')}"]`, encrypted).pop();
if (key) { if (key) {
attrs['encrypted'] = { attrs['encrypted'] = {
'device_id': header.getAttribute('sid'), 'device_id': header.getAttribute('sid'),
...@@ -273,11 +269,10 @@ ...@@ -273,11 +269,10 @@
'payload': _.get(encrypted.querySelector('payload'), 'textContent', null), 'payload': _.get(encrypted.querySelector('payload'), 'textContent', null),
'prekey': key.getAttribute('prekey') 'prekey': key.getAttribute('prekey')
} }
this.decrypt(attrs) return this.decrypt(attrs);
.then((plaintext) => resolve(_.extend(attrs, {'plaintext': plaintext}))) } else {
.catch(reject); return Promise.resolve(attrs);
} }
});
}, },
getMessageAttributesFromStanza (stanza, original_stanza) { getMessageAttributesFromStanza (stanza, original_stanza) {
......
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