parent
0c50808b65
commit
2f149a0ea2
@ -138,20 +138,24 @@
|
|||||||
this.devices.browserStorage = new Backbone.BrowserStorage.session(
|
this.devices.browserStorage = new Backbone.BrowserStorage.session(
|
||||||
b64_sha1(`converse.devicelist-${_converse.bare_jid}-${this.get('jid')}`)
|
b64_sha1(`converse.devicelist-${_converse.bare_jid}-${this.get('jid')}`)
|
||||||
);
|
);
|
||||||
|
this.fetchDevices();
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchDevices () {
|
fetchDevices () {
|
||||||
return new Promise((resolve, reject) => {
|
if (_.isUndefined(this._devices_promise)) {
|
||||||
this.devices.fetch({
|
this._devices_promise = new Promise((resolve, reject) => {
|
||||||
'success': (collection) => {
|
this.devices.fetch({
|
||||||
if (collection.length === 0) {
|
'success': (collection) => {
|
||||||
this.fetchDevicesFromServer().then(resolve).catch(reject);
|
if (collection.length === 0) {
|
||||||
} else {
|
this.fetchDevicesFromServer().then(resolve).catch(reject);
|
||||||
resolve();
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
return this._devices_promise;
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchDevicesFromServer () {
|
fetchDevicesFromServer () {
|
||||||
|
Loading…
Reference in New Issue
Block a user