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
affafc74
Commit
affafc74
authored
Nov 12, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix. Make sure `_devices_promise` is a Promise
parent
1c38863b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
24 deletions
+32
-24
dist/converse.js
dist/converse.js
+17
-12
src/converse-omemo.js
src/converse-omemo.js
+15
-12
No files found.
dist/converse.js
View file @
affafc74
...
@@ -66192,21 +66192,26 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
...
@@ -66192,21 +66192,26 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
fetchDevices() {
fetchDevices() {
if (_.isUndefined(this._devices_promise)) {
if (_.isUndefined(this._devices_promise)) {
const options = {
this._devices_promise = new Promise(resolve => {
'success': c => this.onCachedDevicesFetched(c),
this.devices.fetch({
'error': e => _converse.log(e, Strophe.LogLevel.ERROR)
'success': async collection => {
};
if (collection.length === 0) {
this._devices_promise = this.devices.fetch(options);
const ids = await this.fetchDevicesFromServer();
}
await this.publishCurrentDevice(ids);
}
return this._devices_promise;
resolve();
},
},
'error': e => {
_converse.log(e, Strophe.LogLevel.ERROR);
async onCachedDevicesFetched(collection) {
resolve();
if (collection.length === 0) {
}
const ids = await this.fetchDevicesFromServer(
);
}
);
this.publishCurrentDevice(ids
);
}
);
}
}
return this._devices_promise;
},
},
async publishCurrentDevice(device_ids) {
async publishCurrentDevice(device_ids) {
src/converse-omemo.js
View file @
affafc74
...
@@ -840,22 +840,25 @@ converse.plugins.add('converse-omemo', {
...
@@ -840,22 +840,25 @@ converse.plugins.add('converse-omemo', {
fetchDevices
()
{
fetchDevices
()
{
if
(
_
.
isUndefined
(
this
.
_devices_promise
))
{
if
(
_
.
isUndefined
(
this
.
_devices_promise
))
{
const
options
=
{
this
.
_devices_promise
=
new
Promise
(
resolve
=>
{
'
success
'
:
c
=>
this
.
onCachedDevicesFetched
(
c
),
this
.
devices
.
fetch
({
'
error
'
:
e
=>
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
)
'
success
'
:
async
collection
=>
{
}
if
(
collection
.
length
===
0
)
{
this
.
_devices_promise
=
this
.
devices
.
fetch
(
options
);
const
ids
=
await
this
.
fetchDevicesFromServer
()
await
this
.
publishCurrentDevice
(
ids
);
}
resolve
();
},
'
error
'
:
e
=>
{
_converse
.
log
(
e
,
Strophe
.
LogLevel
.
ERROR
);
resolve
();
}
});
});
}
}
return
this
.
_devices_promise
;
return
this
.
_devices_promise
;
},
},
async
onCachedDevicesFetched
(
collection
)
{
if
(
collection
.
length
===
0
)
{
const
ids
=
await
this
.
fetchDevicesFromServer
()
this
.
publishCurrentDevice
(
ids
);
}
},
async
publishCurrentDevice
(
device_ids
)
{
async
publishCurrentDevice
(
device_ids
)
{
if
(
this
.
get
(
'
jid
'
)
!==
_converse
.
bare_jid
)
{
if
(
this
.
get
(
'
jid
'
)
!==
_converse
.
bare_jid
)
{
// We only publish for ourselves.
// We only publish for ourselves.
...
...
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