Commit b05b5719 authored by JC Brand's avatar JC Brand

In these two cases I prefer explicit Promise callbacks

In both cases we need the `catch` statement due to the fact that a
sendIQ call gets made which rejects for error stanzas (and I find the
Promise form much compacter).

Additionally, we don't want to hold up subsequent execution until
the element has been faded out.
parent 2bcac136
...@@ -248,18 +248,18 @@ converse.plugins.add('converse-muc-views', { ...@@ -248,18 +248,18 @@ converse.plugins.add('converse-muc-views', {
})); }));
} }
async function toggleRoomInfo (ev) { function toggleRoomInfo (ev) {
/* Show/hide extra information about a groupchat in a listing. */ /* Show/hide extra information about a groupchat in a listing. */
const parent_el = u.ancestor(ev.target, '.room-item'), const parent_el = u.ancestor(ev.target, '.room-item'),
div_el = parent_el.querySelector('div.room-info'); div_el = parent_el.querySelector('div.room-info');
if (div_el) { if (div_el) {
await u.slideIn(div_el); u.slideIn(div_el).then(u.removeElement)
u.removeElement();
parent_el.querySelector('a.room-info').classList.remove('selected'); parent_el.querySelector('a.room-info').classList.remove('selected');
} else { } else {
parent_el.insertAdjacentHTML('beforeend', tpl_spinner()); parent_el.insertAdjacentHTML('beforeend', tpl_spinner());
const stanza = await _converse.api.disco.info(ev.target.getAttribute('data-room-jid'), null); _converse.api.disco.info(ev.target.getAttribute('data-room-jid'), null)
insertRoomInfo(parent_el, stanza); .then(stanza => insertRoomInfo(parent_el, stanza))
.catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
} }
} }
...@@ -1142,7 +1142,7 @@ converse.plugins.add('converse-muc-views', { ...@@ -1142,7 +1142,7 @@ converse.plugins.add('converse-muc-views', {
this.renderAfterTransition(); this.renderAfterTransition();
}, },
async getAndRenderConfigurationForm (ev) { getAndRenderConfigurationForm (ev) {
/* Start the process of configuring a groupchat, either by /* Start the process of configuring a groupchat, either by
* rendering a configuration form, or by auto-configuring * rendering a configuration form, or by auto-configuring
* based on the "roomconfig" data stored on the * based on the "roomconfig" data stored on the
...@@ -1158,8 +1158,9 @@ converse.plugins.add('converse-muc-views', { ...@@ -1158,8 +1158,9 @@ converse.plugins.add('converse-muc-views', {
* the settings. * the settings.
*/ */
this.showSpinner(); this.showSpinner();
await this.model.fetchRoomConfiguration(); this.model.fetchRoomConfiguration()
this.renderConfigurationForm(); .then(iq => this.renderConfigurationForm(iq))
.catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
}, },
submitNickname (ev) { submitNickname (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