mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
only request key backup for events that are UTD
This commit is contained in:
parent
30481a5a9e
commit
e7598b9c76
@ -55,7 +55,8 @@ export class RoomEncryption {
|
|||||||
this._sessionBackup = sessionBackup;
|
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 eventsBySession = groupEventsBySession(events);
|
||||||
const groups = Array.from(eventsBySession.values());
|
const groups = Array.from(eventsBySession.values());
|
||||||
const txn = this._storage.readTxn([this._storage.storeNames.inboundGroupSessions]);
|
const txn = this._storage.readTxn([this._storage.storeNames.inboundGroupSessions]);
|
||||||
|
@ -569,8 +569,7 @@ export class Room extends EventEmitter {
|
|||||||
this._roomEncryption?.enableSessionBackup(sessionBackup);
|
this._roomEncryption?.enableSessionBackup(sessionBackup);
|
||||||
// TODO: do we really want to do this every time you open the app?
|
// TODO: do we really want to do this every time you open the app?
|
||||||
if (this._timeline) {
|
if (this._timeline) {
|
||||||
const timelineEvents = this._timeline.remoteEntries.filter(e => e.event).map(e => e.event);
|
this._roomEncryption.restoreMissingSessionsFromBackup(this._timeline.remoteEntries);
|
||||||
this._roomEncryption.restoreMissingSessionsFromBackup(timelineEvents);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user