From 0eee472829dcf31ff9b73323e8eb01cdd8b4c3ac Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 23 Mar 2023 11:46:56 +0100 Subject: [PATCH] feat(sdk): Remove `send_updates_for_items`. This field is always set to `true` by all the clients. So let's consider that something we always want, and let's remove code complexity. --- crates/matrix-sdk/src/sliding_sync/list/builder.rs | 10 ---------- crates/matrix-sdk/src/sliding_sync/list/mod.rs | 10 +--------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/crates/matrix-sdk/src/sliding_sync/list/builder.rs b/crates/matrix-sdk/src/sliding_sync/list/builder.rs index d3cb8dd11..97bb512d3 100644 --- a/crates/matrix-sdk/src/sliding_sync/list/builder.rs +++ b/crates/matrix-sdk/src/sliding_sync/list/builder.rs @@ -26,7 +26,6 @@ pub struct SlidingSyncListBuilder { required_state: Vec<(StateEventType, String)>, full_sync_batch_size: u32, full_sync_maximum_number_of_rooms_to_fetch: Option, - send_updates_for_items: bool, filters: Option, timeline_limit: Option, name: Option, @@ -44,7 +43,6 @@ impl SlidingSyncListBuilder { ], full_sync_batch_size: 20, full_sync_maximum_number_of_rooms_to_fetch: None, - send_updates_for_items: false, filters: None, timeline_limit: None, name: None, @@ -92,13 +90,6 @@ impl SlidingSyncListBuilder { self } - /// Whether the list should send `UpdatedAt`-Diff signals for rooms that - /// have changed. - pub fn send_updates_for_items(mut self, value: bool) -> Self { - self.send_updates_for_items = value; - self - } - /// Any filters to apply to the query. pub fn filters(mut self, value: Option) -> Self { self.filters = value; @@ -177,7 +168,6 @@ impl SlidingSyncListBuilder { full_sync_batch_size: self.full_sync_batch_size, full_sync_maximum_number_of_rooms_to_fetch: self .full_sync_maximum_number_of_rooms_to_fetch, - send_updates_for_items: self.send_updates_for_items, filters: self.filters, timeline_limit: StdRwLock::new(Observable::new(self.timeline_limit)), name: self.name.ok_or(Error::BuildMissingField("name"))?, diff --git a/crates/matrix-sdk/src/sliding_sync/list/mod.rs b/crates/matrix-sdk/src/sliding_sync/list/mod.rs index 088e39334..8a6897b08 100644 --- a/crates/matrix-sdk/src/sliding_sync/list/mod.rs +++ b/crates/matrix-sdk/src/sliding_sync/list/mod.rs @@ -53,7 +53,6 @@ impl SlidingSyncList { .full_sync_maximum_number_of_rooms_to_fetch( self.inner.full_sync_maximum_number_of_rooms_to_fetch, ) - .send_updates_for_items(self.inner.send_updates_for_items) .filters(self.inner.filters.clone()) .ranges(self.inner.ranges.read().unwrap().clone()); @@ -246,10 +245,6 @@ pub(super) struct SlidingSyncListInner { /// rooms to load by using this field. full_sync_maximum_number_of_rooms_to_fetch: Option, - /// Whether the list should send `UpdatedAt`-Diff signals for rooms - /// that have changed. - send_updates_for_items: bool, - /// Any filters to apply to the query. filters: Option, @@ -275,7 +270,6 @@ pub(super) struct SlidingSyncListInner { rooms_list: StdRwLock>, /// The ranges windows of the list. - #[allow(clippy::type_complexity)] // temporarily ranges: StdRwLock>>, is_cold: AtomicBool, @@ -460,7 +454,7 @@ impl SlidingSyncListInner { } } - if self.send_updates_for_items && !updated_rooms.is_empty() { + if !updated_rooms.is_empty() { let found_lists = self.find_rooms_in_list(updated_rooms); if !found_lists.is_empty() { @@ -880,7 +874,6 @@ mod tests { required_state: vec![(StateEventType::RoomName, "baz".to_owned())], full_sync_batch_size: 42, full_sync_maximum_number_of_rooms_to_fetch: Some(153), - send_updates_for_items: true, filters: Some(assign!(v4::SyncRequestListFilters::default(), { is_dm: Some(true), })), @@ -908,7 +901,6 @@ mod tests { required_state, full_sync_batch_size, full_sync_maximum_number_of_rooms_to_fetch, - send_updates_for_items, filters with filters.as_ref().unwrap().is_dm, timeline_limit with **timeline_limit.read().unwrap(), name,