From 3bfe52b1dcb2d4e66209064da76429d7dd54f382 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 2 Mar 2021 21:29:43 +0100 Subject: [PATCH] filter encrypted events before deciding to decrypt or not --- src/matrix/room/Room.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index 392ef264..4ab04314 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -183,11 +183,10 @@ export class Room extends EventEmitter { events = events.concat(retryEntries.map(entry => entry.event)); } } - - if (events.length) { - const eventsToDecrypt = events.filter(event => { - return event?.type === EVENT_ENCRYPTED_TYPE; - }); + const eventsToDecrypt = events.filter(event => { + return event?.type === EVENT_ENCRYPTED_TYPE; + }); + if (eventsToDecrypt.length) { decryptPreparation = await roomEncryption.prepareDecryptAll( eventsToDecrypt, newKeys, DecryptionSource.Sync, txn); }