Use async/await for enterRoom
This commit is contained in:
parent
9b0e23dcc6
commit
0ee08ee622
14
dist/converse.js
vendored
14
dist/converse.js
vendored
|
@ -53709,30 +53709,26 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
|
||||||
this.enterRoom();
|
this.enterRoom();
|
||||||
},
|
},
|
||||||
|
|
||||||
enterRoom(ev) {
|
async enterRoom(ev) {
|
||||||
if (ev) {
|
if (ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.model.get('connection_status') !== _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOMSTATUS.ENTERED) {
|
if (this.model.get('connection_status') !== _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOMSTATUS.ENTERED) {
|
||||||
const handler = () => {
|
await this.model.getRoomFeatures();
|
||||||
|
|
||||||
if (!u.isPersistableModel(this.model)) {
|
if (!u.isPersistableModel(this.model)) {
|
||||||
// Happens during tests, nothing to do if this
|
// XXX: Happens during tests, nothing to do if this
|
||||||
// is a hanging chatbox (i.e. not in the collection anymore).
|
// is a hanging chatbox (i.e. not in the collection anymore).
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.populateAndJoin();
|
this.populateAndJoin();
|
||||||
|
|
||||||
_converse.emit('chatRoomOpened', this);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.model.getRoomFeatures().then(handler, handler);
|
|
||||||
} else {
|
} else {
|
||||||
this.fetchMessages();
|
this.fetchMessages();
|
||||||
|
}
|
||||||
|
|
||||||
_converse.emit('chatRoomOpened', this);
|
_converse.emit('chatRoomOpened', this);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -512,23 +512,20 @@ converse.plugins.add('converse-muc-views', {
|
||||||
this.enterRoom();
|
this.enterRoom();
|
||||||
},
|
},
|
||||||
|
|
||||||
enterRoom (ev) {
|
async enterRoom (ev) {
|
||||||
if (ev) { ev.preventDefault(); }
|
if (ev) { ev.preventDefault(); }
|
||||||
if (this.model.get('connection_status') !== converse.ROOMSTATUS.ENTERED) {
|
if (this.model.get('connection_status') !== converse.ROOMSTATUS.ENTERED) {
|
||||||
const handler = () => {
|
await this.model.getRoomFeatures();
|
||||||
if (!u.isPersistableModel(this.model)) {
|
if (!u.isPersistableModel(this.model)) {
|
||||||
// Happens during tests, nothing to do if this
|
// XXX: Happens during tests, nothing to do if this
|
||||||
// is a hanging chatbox (i.e. not in the collection anymore).
|
// is a hanging chatbox (i.e. not in the collection anymore).
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.populateAndJoin();
|
this.populateAndJoin();
|
||||||
_converse.emit('chatRoomOpened', this);
|
|
||||||
}
|
|
||||||
this.model.getRoomFeatures().then(handler, handler);
|
|
||||||
} else {
|
} else {
|
||||||
this.fetchMessages();
|
this.fetchMessages();
|
||||||
_converse.emit('chatRoomOpened', this);
|
|
||||||
}
|
}
|
||||||
|
_converse.emit('chatRoomOpened', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user