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
cc3735ff
Commit
cc3735ff
authored
Nov 05, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use async/await
parent
87c77385
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
37 deletions
+39
-37
dist/converse.js
dist/converse.js
+23
-20
src/headless/converse-roster.js
src/headless/converse-roster.js
+16
-17
No files found.
dist/converse.js
View file @
cc3735ff
...
...
@@ -64996,8 +64996,8 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
chatstate_notification_blacklist: [],
// ^ a list of JIDs to ignore concerning chat state notifications
play_sounds: true,
sounds_path: '
/
sounds/',
notification_icon: '
/
logo/conversejs-filled.svg'
sounds_path: 'sounds/',
notification_icon: 'logo/conversejs-filled.svg'
});
_converse.isOnlyChatStateNotification = msg => // See XEP-0085 Chat State Notification
...
...
@@ -77202,7 +77202,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
}, Strophe.NS.ROSTERX, 'message', null);
},
fetchRosterContacts() {
async
fetchRosterContacts() {
/* Fetches the roster contacts, first by trying the
* sessionStorage cache, and if that's empty, then by querying
* the XMPP server.
...
...
@@ -77210,26 +77210,29 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
* Returns a promise which resolves once the contacts have been
* fetched.
*/
const that = this;
return new Promise((resolve, reject) => {
this.fetch({
let collection;
try {
collection = await new Promise((resolve, reject) => {
const config = {
'add': true,
'silent': true,
'success': resolve,
'error': reject
};
this.fetch(config);
});
} catch (e) {
return _converse.log(e, Strophe.LogLevel.ERROR);
}
success(collection) {
if (collection.length === 0 || that.rosterVersioningSupported() && !_converse.session.get('roster_fetched')) {
if (collection.length === 0 || this.rosterVersioningSupported() && !_converse.session.get('roster_fetched')) {
_converse.send_initial_presence = true;
_converse.roster.fetchFromServer().then(resolve).catch(reject
);
_converse.roster.fetchFromServer(
);
} else {
_converse.emit('cachedRoster', collection);
resolve();
}
}
});
});
},
subscribeToSuggestedItems(msg) {
src/headless/converse-roster.js
View file @
cc3735ff
...
...
@@ -390,7 +390,7 @@ converse.plugins.add('converse-roster', {
);
},
fetchRosterContacts
()
{
async
fetchRosterContacts
()
{
/* Fetches the roster contacts, first by trying the
* sessionStorage cache, and if that's empty, then by querying
* the XMPP server.
...
...
@@ -398,23 +398,22 @@ converse.plugins.add('converse-roster', {
* Returns a promise which resolves once the contacts have been
* fetched.
*/
const
that
=
this
;
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
fetch
({
'
add
'
:
true
,
'
silent
'
:
true
,
success
(
collection
)
{
let
collection
;
try
{
collection
=
await
new
Promise
((
resolve
,
reject
)
=>
{
const
config
=
{
'
add
'
:
true
,
'
silent
'
:
true
,
'
success
'
:
resolve
,
'
error
'
:
reject
};
this
.
fetch
(
config
);
});
}
catch
(
e
)
{
return
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
}
if
(
collection
.
length
===
0
||
(
that
.
rosterVersioningSupported
()
&&
!
_converse
.
session
.
get
(
'
roster_fetched
'
)))
{
(
this
.
rosterVersioningSupported
()
&&
!
_converse
.
session
.
get
(
'
roster_fetched
'
)))
{
_converse
.
send_initial_presence
=
true
;
_converse
.
roster
.
fetchFromServer
().
then
(
resolve
).
catch
(
reject
);
_converse
.
roster
.
fetchFromServer
(
);
}
else
{
_converse
.
emit
(
'
cachedRoster
'
,
collection
);
resolve
();
}
}
});
});
},
subscribeToSuggestedItems
(
msg
)
{
...
...
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