Commit 1269d53e authored by JC Brand's avatar JC Brand

Move `enterRoom` method to the model

parent 4c924a66
......@@ -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
......
......@@ -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();
......
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