Commit bb78d851 authored by JC Brand's avatar JC Brand

Use async function instead of explicit promises

parent 23cb7d31
......@@ -72993,24 +72993,23 @@ 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(), {
'__': __
}));
if (support) {
const icon = this.el.querySelector('.toggle-omemo'),
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {
'__': __
}));
if (icon) {
icon.outerHTML = html;
} else {
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
}
if (icon) {
icon.outerHTML = html;
} else {
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
}
},
toggleOMEMO(ev) {
......@@ -447,20 +447,18 @@
}
},
renderOMEMOToolbarButton () {
const { _converse } = this.__super__,
{ __ } = _converse;
_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(), {'__': __}));
if (icon) {
icon.outerHTML = html;
} else {
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
}
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(), {'__': __}));
if (icon) {
icon.outerHTML = html;
} else {
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
}
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
}
},
toggleOMEMO (ev) {
......
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