Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
0ee08ee6
Commit
0ee08ee6
authored
Feb 22, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use async/await for `enterRoom`
parent
9b0e23dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
25 deletions
+18
-25
dist/converse.js
dist/converse.js
+10
-14
src/converse-muc-views.js
src/converse-muc-views.js
+8
-11
No files found.
dist/converse.js
View file @
0ee08ee6
...
...
@@ -53709,30 +53709,26 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins
this.enterRoom();
},
enterRoom(ev) {
async
enterRoom(ev) {
if (ev) {
ev.preventDefault();
}
if (this.model.get('connection_status') !== _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOMSTATUS.ENTERED) {
const handler = () => {
if (!u.isPersistableModel(this.model)) {
// Happens during tests, nothing to do if this
// is a hanging chatbox (i.e. not in the collection anymore).
return;
}
await this.model.getRoomFeatures();
this.populateAndJoin();
_converse.emit('chatRoomOpened', this);
};
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.getRoomFeatures().then(handler, handler
);
this.
populateAndJoin(
);
} else {
this.fetchMessages();
_converse.emit('chatRoomOpened', this);
}
_converse.emit('chatRoomOpened', this);
},
render() {
src/converse-muc-views.js
View file @
0ee08ee6
...
...
@@ -512,23 +512,20 @@ converse.plugins.add('converse-muc-views', {
this
.
enterRoom
();
},
enterRoom
(
ev
)
{
async
enterRoom
(
ev
)
{
if
(
ev
)
{
ev
.
preventDefault
();
}
if
(
this
.
model
.
get
(
'
connection_status
'
)
!==
converse
.
ROOMSTATUS
.
ENTERED
)
{
const
handler
=
()
=>
{
if
(
!
u
.
isPersistableModel
(
this
.
model
))
{
// Happens during tests, nothing to do if this
// is a hanging chatbox (i.e. not in the collection anymore).
return
;
}
this
.
populateAndJoin
();
_converse
.
emit
(
'
chatRoomOpened
'
,
this
);
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
.
getRoomFeatures
().
then
(
handler
,
handler
);
this
.
populateAndJoin
(
);
}
else
{
this
.
fetchMessages
();
_converse
.
emit
(
'
chatRoomOpened
'
,
this
);
}
_converse
.
emit
(
'
chatRoomOpened
'
,
this
);
},
render
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment