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', { ...@@ -572,19 +572,6 @@ converse.plugins.add('converse-muc-views', {
this.createOccupantsView(); this.createOccupantsView();
this.insertIntoDOM(); this.insertIntoDOM();
this.registerHandlers(); 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 * Triggered once a groupchat has been opened
* @event _converse#chatRoomOpened * @event _converse#chatRoomOpened
......
...@@ -218,8 +218,22 @@ converse.plugins.add('converse-muc', { ...@@ -218,8 +218,22 @@ converse.plugins.add('converse-muc', {
this.initOccupants(); this.initOccupants();
this.registerHandlers(); this.registerHandlers();
this.initMessages(); 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 () { async onConnectionStatusChanged () {
if (this.get('connection_status') === converse.ROOMSTATUS.ENTERED) { if (this.get('connection_status') === converse.ROOMSTATUS.ENTERED) {
this.occupants.fetchMembers(); 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