feat(ui): Enable TimelineSettings::vectordiffs_as_inputs if event cache storage is enabled.

This patch automatically enables
`TimelineSettings::vectordiffs_as_inputs` if and only if the event cache
storage is enabled.
This commit is contained in:
Ivan Enderlin
2024-12-20 10:27:48 +01:00
parent 51c76a15ad
commit c4132252d3
2 changed files with 12 additions and 2 deletions
+7 -2
View File
@@ -162,12 +162,17 @@ impl TimelineBuilder {
)
)]
pub async fn build(self) -> Result<Timeline, Error> {
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()?;
+5
View File
@@ -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.
///