You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Null fix & lint
Don't end up with devices / device tracking status being null
This commit is contained in:
@@ -68,11 +68,11 @@ export default class DeviceList {
|
|||||||
// [device info]
|
// [device info]
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
this._devices = null;
|
this._devices = {};
|
||||||
|
|
||||||
// which users we are tracking device status for.
|
// which users we are tracking device status for.
|
||||||
// userId -> TRACKING_STATUS_*
|
// userId -> TRACKING_STATUS_*
|
||||||
this._deviceTrackingStatus = null; // loaded from storage in load()
|
this._deviceTrackingStatus = {}; // loaded from storage in load()
|
||||||
|
|
||||||
// The 'next_batch' sync token at the point the data was writen,
|
// The 'next_batch' sync token at the point the data was writen,
|
||||||
// ie. a token represtenting the point immediately after the
|
// ie. a token represtenting the point immediately after the
|
||||||
@@ -104,8 +104,10 @@ export default class DeviceList {
|
|||||||
this._cryptoStore.getEndToEndDeviceData(txn, (deviceData) => {
|
this._cryptoStore.getEndToEndDeviceData(txn, (deviceData) => {
|
||||||
if (deviceData === null) {
|
if (deviceData === null) {
|
||||||
console.log("Migrating e2e device data...");
|
console.log("Migrating e2e device data...");
|
||||||
this._devices = this._sessionStore.getAllEndToEndDevices();
|
this._devices = this._sessionStore.getAllEndToEndDevices() || {};
|
||||||
this._deviceTrackingStatus = this._sessionStore.getEndToEndDeviceTrackingStatus();
|
this._deviceTrackingStatus = (
|
||||||
|
this._sessionStore.getEndToEndDeviceTrackingStatus() || {}
|
||||||
|
);
|
||||||
this._syncToken = this._sessionStore.getEndToEndDeviceSyncToken();
|
this._syncToken = this._sessionStore.getEndToEndDeviceSyncToken();
|
||||||
this._cryptoStore.storeEndToEndDeviceData({
|
this._cryptoStore.storeEndToEndDeviceData({
|
||||||
devices: this._devices,
|
devices: this._devices,
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ function Crypto(baseApis, sessionStore, userId, deviceId,
|
|||||||
this._cryptoStore = cryptoStore;
|
this._cryptoStore = cryptoStore;
|
||||||
|
|
||||||
this._olmDevice = new OlmDevice(sessionStore, cryptoStore);
|
this._olmDevice = new OlmDevice(sessionStore, cryptoStore);
|
||||||
this._deviceList = new DeviceList(baseApis, cryptoStore, sessionStore, this._olmDevice);
|
this._deviceList = new DeviceList(
|
||||||
|
baseApis, cryptoStore, sessionStore, this._olmDevice,
|
||||||
|
);
|
||||||
|
|
||||||
// the last time we did a check for the number of one-time-keys on the
|
// the last time we did a check for the number of one-time-keys on the
|
||||||
// server.
|
// server.
|
||||||
|
|||||||
Reference in New Issue
Block a user