From d88720a18f852c290de980527a8dbcc02bbea720 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 15 Mar 2021 16:54:43 +0100 Subject: [PATCH] don't start key backup operation if not enabled --- src/matrix/e2ee/RoomEncryption.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/matrix/e2ee/RoomEncryption.js b/src/matrix/e2ee/RoomEncryption.js index de12fc1d..ddb6e4c4 100644 --- a/src/matrix/e2ee/RoomEncryption.js +++ b/src/matrix/e2ee/RoomEncryption.js @@ -142,15 +142,19 @@ export class RoomEncryption { if (!missingSessionEvents.length) { return; } + // store missing event ids if received from sync const missingEventsBySession = groupEventsBySession(missingSessionEvents); if (source === DecryptionSource.Sync) { - // store missing event ids if received from sync await Promise.all(Array.from(missingEventsBySession.values()).map(async group => { const eventIds = group.events.map(e => e.event_id); return this._megolmDecryption.addMissingKeyEventIds( this._room.id, group.senderKey, group.sessionId, eventIds, txn); })); } + + if (!this._sessionBackup) { + return; + } log.wrapDetached("check key backup", async log => { // if the message came from sync, wait 10s to see if the room key arrives late,