Move enterRoom
method to the model
This commit is contained in:
parent
4c924a66df
commit
1269d53e02
@ -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', {
|
|||||||
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();
|
||||||
|
Loading…
Reference in New Issue
Block a user