only request key backup for events that are UTD

This commit is contained in:
Bruno Windels 2021-03-03 12:52:43 +01:00
parent 30481a5a9e
commit e7598b9c76
2 changed files with 3 additions and 3 deletions

View file

@ -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]);

View file

@ -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);
}
}