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