Commit 7511d8c3 authored by JC Brand's avatar JC Brand

Always clear messages and occupants cache before (re)entering a room

parent e053b970
...@@ -231,6 +231,11 @@ converse.plugins.add('converse-muc', { ...@@ -231,6 +231,11 @@ converse.plugins.add('converse-muc', {
async enterRoom () { async enterRoom () {
if (this.get('connection_status') !== converse.ROOMSTATUS.ENTERED) { if (this.get('connection_status') !== converse.ROOMSTATUS.ENTERED) {
// We're not restoring a room from cache, so let's clear
// the cache (which might be stale).
this.clearMessages();
this.clearOccupants();
await this.getRoomFeatures(); await this.getRoomFeatures();
if (!u.isPersistableModel(this)) { if (!u.isPersistableModel(this)) {
// XXX: Happens during tests, nothing to do if this // XXX: Happens during tests, nothing to do if this
...@@ -264,13 +269,11 @@ converse.plugins.add('converse-muc', { ...@@ -264,13 +269,11 @@ converse.plugins.add('converse-muc', {
} }
}, },
onReconnection () { async onReconnection () {
this.save('connection_status', converse.ROOMSTATUS.DISCONNECTED); this.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
this.clearMessages();
this.clearOccupants();
this.registerHandlers(); this.registerHandlers();
await this.enterRoom();
this.announceReconnection(); this.announceReconnection();
this.enterRoom();
}, },
initFeatures () { initFeatures () {
......
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