diff --git a/src/matrix/e2ee/RoomEncryption.js b/src/matrix/e2ee/RoomEncryption.js index 59994c0f..f7a1920e 100644 --- a/src/matrix/e2ee/RoomEncryption.js +++ b/src/matrix/e2ee/RoomEncryption.js @@ -55,7 +55,8 @@ export class RoomEncryption { this._sessionBackup = sessionBackup; } - async restoreMissingSessionsFromBackup(events) { + async restoreMissingSessionsFromBackup(entries) { + const events = entries.filter(e => e.isEncrypted && !e.isDecrypted && e.event).map(e => e.event); const eventsBySession = groupEventsBySession(events); const groups = Array.from(eventsBySession.values()); const txn = this._storage.readTxn([this._storage.storeNames.inboundGroupSessions]); diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index cc325aa4..c9f577cb 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -569,8 +569,7 @@ export class Room extends EventEmitter { this._roomEncryption?.enableSessionBackup(sessionBackup); // TODO: do we really want to do this every time you open the app? if (this._timeline) { - const timelineEvents = this._timeline.remoteEntries.filter(e => e.event).map(e => e.event); - this._roomEncryption.restoreMissingSessionsFromBackup(timelineEvents); + this._roomEncryption.restoreMissingSessionsFromBackup(this._timeline.remoteEntries); } }