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.
This commit is contained in:
Ivan Enderlin
2023-03-23 11:46:56 +01:00
parent 296328e8e0
commit 0eee472829
2 changed files with 1 additions and 19 deletions

View File

@@ -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<u32>,
send_updates_for_items: bool,
filters: Option<v4::SyncRequestListFilters>,
timeline_limit: Option<UInt>,
name: Option<String>,
@@ -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<v4::SyncRequestListFilters>) -> 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"))?,

View File

@@ -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<u32>,
/// 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<v4::SyncRequestListFilters>,
@@ -275,7 +270,6 @@ pub(super) struct SlidingSyncListInner {
rooms_list: StdRwLock<ObservableVector<RoomListEntry>>,
/// The ranges windows of the list.
#[allow(clippy::type_complexity)] // temporarily
ranges: StdRwLock<Observable<Vec<(UInt, UInt)>>>,
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,