Commit dee10bfe authored by JC Brand's avatar JC Brand

Clear MUC disco after closing a room

This is to avoid having a stale/inaccurate MUC features list when
reopening a previously closed MUC
parent cd05b897
......@@ -304,6 +304,10 @@
*/
this.occupants.browserStorage._clear();
this.occupants.reset();
const disco_entity = _converse.disco_entities.get(this.get('jid'));
if (disco_entity) {
disco_entity.destroy();
}
if (_converse.connection.connected) {
this.sendUnavailablePresence(exit_msg);
}
......
......@@ -130,13 +130,12 @@
return _converse.api.rooms.open(room_jid).then(() => {
view = _converse.chatboxviews.get(room_jid);
if (!_converse.disco_entities.get(room_jid)) {
utils.waitUntil(() => _.get(_.filter(
return utils.waitUntil(() => _.get(_.filter(
stanzas,
iq => iq.nodeTree.querySelector(
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
)).pop(), 'nodeTree'))
.then(stanza => {
)).pop(), 'nodeTree'));
}).then(stanza => {
const features_stanza = $iq({
'from': room_jid,
'id': stanza.getAttribute('id'),
......@@ -164,8 +163,6 @@
.c('field', {'type':'text-single', 'var':'muc#roominfo_occupants', 'label':'Number of occupants'})
.c('value').t(0);
_converse.connection._dataRecv(utils.createRequest(features_stanza));
});
}
return utils.waitUntil(() => _.filter(
stanzas,
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length
......
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