From e515548037f01dc1a707227808ef7e6eaa63cd9e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 11 Feb 2021 21:08:06 +0100 Subject: [PATCH] add some comments while debugging a problem --- src/matrix/Session.js | 2 +- src/matrix/e2ee/DeviceTracker.js | 7 +++++++ src/matrix/storage/idb/Transaction.js | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 9952414c..320556ca 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -287,7 +287,7 @@ export class Session { } /** - * @internal called when coming back online + * @internal called from session container when coming back online and catchup syncs have finished. * @param {Object} lastVersionResponse a response from /versions, which is polled while offline, * and useful to store so we can later tell what capabilities * our homeserver has. diff --git a/src/matrix/e2ee/DeviceTracker.js b/src/matrix/e2ee/DeviceTracker.js index bf6f1403..3f3c9a88 100644 --- a/src/matrix/e2ee/DeviceTracker.js +++ b/src/matrix/e2ee/DeviceTracker.js @@ -45,6 +45,13 @@ export class DeviceTracker { async writeDeviceChanges(deviceLists, txn) { const {userIdentities} = txn; + // TODO: should we also look at left here to handle this?: + // the usual problem here is that you share a room with a user, + // go offline, the remote user leaves the room, changes their devices, + // then rejoins the room you share (or another room). + // At which point you come online, all of this happens in the gap, + // and you don't notice that they ever left, + // and so the client doesn't invalidate their device cache for the user if (Array.isArray(deviceLists.changed) && deviceLists.changed.length) { await Promise.all(deviceLists.changed.map(async userId => { const user = await userIdentities.get(userId); diff --git a/src/matrix/storage/idb/Transaction.js b/src/matrix/storage/idb/Transaction.js index 08eacb34..8d5ba232 100644 --- a/src/matrix/storage/idb/Transaction.js +++ b/src/matrix/storage/idb/Transaction.js @@ -121,6 +121,7 @@ export class Transaction { } abort() { + // TODO: should we wrap the exception in a StorageError? this._txn.abort(); } }