diff --git a/crates/matrix-sdk-ui/src/timeline/builder.rs b/crates/matrix-sdk-ui/src/timeline/builder.rs index ab850666e..2032ad5f4 100644 --- a/crates/matrix-sdk-ui/src/timeline/builder.rs +++ b/crates/matrix-sdk-ui/src/timeline/builder.rs @@ -162,12 +162,17 @@ impl TimelineBuilder { ) )] pub async fn build(self) -> Result { - let Self { room, settings, unable_to_decrypt_hook, focus, internal_id_prefix } = self; - let settings_vectordiffs_as_inputs = settings.vectordiffs_as_inputs; + let Self { room, mut settings, unable_to_decrypt_hook, focus, internal_id_prefix } = self; let client = room.client(); let event_cache = client.event_cache(); + // Enable `TimelineSettings::vectordiffs_as_inputs` if and only if the event + // cache storage is enabled. + settings.vectordiffs_as_inputs = event_cache.has_storage(); + + let settings_vectordiffs_as_inputs = settings.vectordiffs_as_inputs; + // Subscribe the event cache to sync responses, in case we hadn't done it yet. event_cache.subscribe()?; diff --git a/crates/matrix-sdk/src/event_cache/mod.rs b/crates/matrix-sdk/src/event_cache/mod.rs index 20a3e90c3..6f2885839 100644 --- a/crates/matrix-sdk/src/event_cache/mod.rs +++ b/crates/matrix-sdk/src/event_cache/mod.rs @@ -175,6 +175,11 @@ impl EventCache { Ok(()) } + /// Check whether the storage is enabled or not. + pub fn has_storage(&self) -> bool { + self.inner.has_storage() + } + /// Starts subscribing the [`EventCache`] to sync responses, if not done /// before. ///