Use async function instead of explicit promises

This commit is contained in:
JC Brand 2018-10-18 07:03:42 +02:00
parent 23cb7d31ec
commit bb78d8519f
2 changed files with 23 additions and 26 deletions

5
dist/converse.js vendored
View File

@ -72993,11 +72993,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
}
},
renderOMEMOToolbarButton() {
async renderOMEMOToolbarButton() {
const _converse = this.__super__._converse,
__ = _converse.__;
const support = await _converse.contactHasOMEMOSupport(this.model.get('jid'));
_converse.contactHasOMEMOSupport(this.model.get('jid')).then(support => {
if (support) {
const icon = this.el.querySelector('.toggle-omemo'),
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {
@ -73010,7 +73010,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
}
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
},
toggleOMEMO(ev) {

View File

@ -447,10 +447,9 @@
}
},
renderOMEMOToolbarButton () {
const { _converse } = this.__super__,
{ __ } = _converse;
_converse.contactHasOMEMOSupport(this.model.get('jid')).then((support) => {
async renderOMEMOToolbarButton () {
const { _converse } = this.__super__, { __ } = _converse;
const support = await _converse.contactHasOMEMOSupport(this.model.get('jid'));
if (support) {
const icon = this.el.querySelector('.toggle-omemo'),
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {'__': __}));
@ -460,7 +459,6 @@
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
}
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
},
toggleOMEMO (ev) {