fixup! feat(room): make load_event_with_relations also load relations when falling back to the network

Cache related events after loading them

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
This commit is contained in:
Johannes Marbach
2025-12-05 16:19:35 +01:00
committed by Andy Balaam
parent c82e1b8ec3
commit db4e1b2c00

View File

@@ -4100,7 +4100,16 @@ impl Room {
event_id: OwnedEventId,
opts: RelationsOptions,
) -> Result<Relations> {
opts.send(self, event_id).await
let relations = opts.send(self, event_id).await;
// Save any new related events to the cache.
if let Ok(Relations { chunk, .. }) = &relations
&& let Ok((cache, _handles)) = self.event_cache().await
{
cache.save_events(chunk.clone()).await;
}
relations
}
/// Search this room's [`RoomIndex`] for query and return at most