diff --git a/src/converse-muc-views.js b/src/converse-muc-views.js index ad4d93732..44f8daeef 100644 --- a/src/converse-muc-views.js +++ b/src/converse-muc-views.js @@ -572,19 +572,6 @@ converse.plugins.add('converse-muc-views', { this.createOccupantsView(); this.insertIntoDOM(); this.registerHandlers(); - this.enterRoom(); - }, - - async enterRoom () { - if (this.model.get('connection_status') !== converse.ROOMSTATUS.ENTERED) { - await this.model.getRoomFeatures(); - if (!u.isPersistableModel(this.model)) { - // XXX: Happens during tests, nothing to do if this - // is a hanging chatbox (i.e. not in the collection anymore). - return; - } - this.model.join(); - } /** * Triggered once a groupchat has been opened * @event _converse#chatRoomOpened diff --git a/src/headless/converse-muc.js b/src/headless/converse-muc.js index 501d2f1d4..67a47cb01 100644 --- a/src/headless/converse-muc.js +++ b/src/headless/converse-muc.js @@ -218,8 +218,22 @@ converse.plugins.add('converse-muc', { this.initOccupants(); this.registerHandlers(); this.initMessages(); + this.enterRoom(); }, + async enterRoom () { + if (this.get('connection_status') !== converse.ROOMSTATUS.ENTERED) { + await this.getRoomFeatures(); + if (!u.isPersistableModel(this)) { + // XXX: Happens during tests, nothing to do if this + // is a hanging chatbox (i.e. not in the collection anymore). + return; + } + this.join(); + } + }, + + async onConnectionStatusChanged () { if (this.get('connection_status') === converse.ROOMSTATUS.ENTERED) { this.occupants.fetchMembers();