MUC: provide feedback when no rooms found

This commit is contained in:
JC Brand 2020-04-27 18:31:56 +02:00
parent be2def5fad
commit 5efb7b2a84
2 changed files with 5 additions and 4 deletions

View File

@ -468,15 +468,16 @@ converse.plugins.add('converse-muc-views', {
* @param { HTMLElement } iq
*/
onRoomsFound (iq) {
this.loading_items = false;
const rooms = iq ? sizzle('query item', iq) : [];
if (rooms.length) {
this.model.set({'feedback_text': __('Groupchats found')}, {'silent': true});
this.items = rooms.map(st.getAttributes);
this.loading_items = false;
this.render();
} else {
this.model.set('feedback_text', __('No groupchats found'));
this.items = [];
this.model.set({'feedback_text': __('No groupchats found')}, {'silent': true});
}
this.render();
return true;
},

View File

@ -59,7 +59,7 @@ export default (o) => html`
${o.show_form ? form(o) : '' }
<ul class="available-chatrooms list-group">
${ o.loading_items ? html`<li class="list-group-item"> ${spinner()} </li>` : '' }
${ o.items.length ? html`<li class="list-group-item active">${ o.feedback_text }:</li>` : '' }
${ o.feedback_text ? html`<li class="list-group-item active">${ o.feedback_text }</li>` : '' }
${repeat(o.items, item => item.jid, item => tpl_item(o, item))}
</ul>
</div>