log verifying senders in own item

This commit is contained in:
Bruno Windels 2022-11-03 16:37:38 +01:00
parent 2582600249
commit dfede83c0b

View File

@ -309,15 +309,16 @@ export class Room extends BaseRoom {
promises.push(this._roomEncryption.flushPendingRoomKeyShares(this._hsApi, null, log)); promises.push(this._roomEncryption.flushPendingRoomKeyShares(this._hsApi, null, log));
} }
if (shouldFetchUnverifiedSenders) { if (shouldFetchUnverifiedSenders) {
const promise = (async () => { const promise = log.wrap("verify senders", (async log => {
const newlyVerifiedDecryption = await decryption.fetchAndVerifyRemainingSenders(this._hsApi, log); const newlyVerifiedDecryption = await decryption.fetchAndVerifyRemainingSenders(this._hsApi, log);
const verifiedEntries = []; const verifiedEntries = [];
const updateCallback = entry => verifiedEntries.push(entry); const updateCallback = entry => verifiedEntries.push(entry);
newlyVerifiedDecryption.applyToEntries(newEntries, updateCallback); newlyVerifiedDecryption.applyToEntries(newEntries, updateCallback);
newlyVerifiedDecryption.applyToEntries(updatedEntries, updateCallback); newlyVerifiedDecryption.applyToEntries(updatedEntries, updateCallback);
log.set("verifiedEntries", verifiedEntries.length);
this._timeline?.replaceEntries(verifiedEntries); this._timeline?.replaceEntries(verifiedEntries);
this._observedEvents?.updateEvents(verifiedEntries); this._observedEvents?.updateEvents(verifiedEntries);
}); }));
promises.push(promise); promises.push(promise);
} }
await Promise.all(promises); await Promise.all(promises);