filter encrypted events before deciding to decrypt or not

This commit is contained in:
Bruno Windels 2021-03-02 21:29:43 +01:00
parent 9702c4fd64
commit 3bfe52b1dc

View File

@ -183,11 +183,10 @@ export class Room extends EventEmitter {
events = events.concat(retryEntries.map(entry => entry.event)); events = events.concat(retryEntries.map(entry => entry.event));
} }
} }
if (events.length) {
const eventsToDecrypt = events.filter(event => { const eventsToDecrypt = events.filter(event => {
return event?.type === EVENT_ENCRYPTED_TYPE; return event?.type === EVENT_ENCRYPTED_TYPE;
}); });
if (eventsToDecrypt.length) {
decryptPreparation = await roomEncryption.prepareDecryptAll( decryptPreparation = await roomEncryption.prepareDecryptAll(
eventsToDecrypt, newKeys, DecryptionSource.Sync, txn); eventsToDecrypt, newKeys, DecryptionSource.Sync, txn);
} }