Commit 5efb7b2a authored by JC Brand's avatar JC Brand

MUC: provide feedback when no rooms found

parent be2def5f
......@@ -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;
},
......
......@@ -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>
......
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