Use async function instead of explicit promises
This commit is contained in:
parent
23cb7d31ec
commit
bb78d8519f
25
dist/converse.js
vendored
25
dist/converse.js
vendored
@ -72993,24 +72993,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
renderOMEMOToolbarButton() {
|
async renderOMEMOToolbarButton() {
|
||||||
const _converse = this.__super__._converse,
|
const _converse = this.__super__._converse,
|
||||||
__ = _converse.__;
|
__ = _converse.__;
|
||||||
|
const support = await _converse.contactHasOMEMOSupport(this.model.get('jid'));
|
||||||
|
|
||||||
_converse.contactHasOMEMOSupport(this.model.get('jid')).then(support => {
|
if (support) {
|
||||||
if (support) {
|
const icon = this.el.querySelector('.toggle-omemo'),
|
||||||
const icon = this.el.querySelector('.toggle-omemo'),
|
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {
|
||||||
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {
|
'__': __
|
||||||
'__': __
|
}));
|
||||||
}));
|
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.outerHTML = html;
|
icon.outerHTML = html;
|
||||||
} else {
|
} else {
|
||||||
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
|
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleOMEMO(ev) {
|
toggleOMEMO(ev) {
|
||||||
|
@ -447,20 +447,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
renderOMEMOToolbarButton () {
|
async renderOMEMOToolbarButton () {
|
||||||
const { _converse } = this.__super__,
|
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) {
|
||||||
if (support) {
|
const icon = this.el.querySelector('.toggle-omemo'),
|
||||||
const icon = this.el.querySelector('.toggle-omemo'),
|
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {'__': __}));
|
||||||
html = tpl_toolbar_omemo(_.extend(this.model.toJSON(), {'__': __}));
|
if (icon) {
|
||||||
if (icon) {
|
icon.outerHTML = html;
|
||||||
icon.outerHTML = html;
|
} else {
|
||||||
} else {
|
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
|
||||||
this.el.querySelector('.chat-toolbar').insertAdjacentHTML('beforeend', html);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleOMEMO (ev) {
|
toggleOMEMO (ev) {
|
||||||
|
Loading…
Reference in New Issue
Block a user