1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Fix device tracking with initial /sync

* Check whether we share an e2e room with user IDs in the 'left'
   field of /keys/changes: there's no guarantee we no longer share
   any e2e rooms with these users
 * Reset everyone's tracking status on an initial sync - just
   re-fetching device lists for all users we're currently tracking
   isn't good enough since room memberships may have changed.
 * Fix typo in test
This commit is contained in:
David Baker
2018-01-17 16:03:46 +00:00
parent 585ea14a23
commit 5bab8647b6
4 changed files with 58 additions and 23 deletions

View File

@@ -417,6 +417,19 @@ export default class DeviceList {
this._dirty = true;
}
/**
* Set all users we're currently tracking to untracked
*
* This will flag each user whose devices we are tracking as in need of an
* update.
*/
stopTrackingAllDeviceLists() {
for (const userId of Object.keys(this._deviceTrackingStatus)) {
this._deviceTrackingStatus[userId] = TRACKING_STATUS_NOT_TRACKED;
}
console.log("stopped tracking all: "+JSON.stringify(this._deviceTrackingStatus));
this._dirty = true;
}
/**
* Mark the cached device list for the given user outdated.
@@ -440,18 +453,6 @@ export default class DeviceList {
this._dirty = true;
}
/**
* Mark all tracked device lists as outdated.
*
* This will flag each user whose devices we are tracking as in need of an
* update.
*/
invalidateAllDeviceLists() {
for (const userId of Object.keys(this._deviceTrackingStatus)) {
this.invalidateUserDeviceList(userId);
}
}
/**
* If we have users who have outdated device lists, start key downloads for them
*