also fetch unknown sender keys after decrypting entries outside of sync

This commit is contained in:
Bruno Windels 2022-10-28 16:55:36 +02:00
parent dc25f96e73
commit 6123d794da

View File

@ -166,6 +166,16 @@ export class BaseRoom extends EventEmitter {
if (this._observedEvents) {
this._observedEvents.updateEvents(entries);
}
if (isTimelineOpen && decryption.hasUnverifiedSenders) {
// verify missing senders async and update timeline once done so we don't delay rendering with network requests
log.wrapDetached("fetch unknown senders keys", async () => {
const newlyVerifiedDecryption = await decryption.fetchAndVerifyRemainingSenders(this._hsApi, log);
const verifiedEntries = [];
newlyVerifiedDecryption.applyToEntries(entries, entry => verifiedEntries.push(entry));
this._timeline?.replaceEntries(verifiedEntries);
this._observedEvents?.updateEvents(verifiedEntries);
});
}
}, ensureLogItem(log));
return request;
}