diff --git a/crates/matrix-sdk-ui/src/timeline/inner/mod.rs b/crates/matrix-sdk-ui/src/timeline/inner/mod.rs index 2a240e56d..120a5fcb6 100644 --- a/crates/matrix-sdk-ui/src/timeline/inner/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/inner/mod.rs @@ -609,7 +609,7 @@ impl TimelineInner

{ if let Some(fully_read_event_id) = self.room_data_provider.load_fully_read_marker().await { - state.set_fully_read_event(fully_read_event_id); + state.handle_fully_read_marker(fully_read_event_id); } } } @@ -857,11 +857,6 @@ impl TimelineInner

{ true } - #[cfg(test)] - pub(super) async fn set_fully_read_event(&self, fully_read_event_id: OwnedEventId) { - self.state.write().await.set_fully_read_event(fully_read_event_id); - } - #[cfg(feature = "e2e-encryption")] #[instrument(skip(self, room), fields(room_id = ?room.room_id()))] pub(super) async fn retry_event_decryption( diff --git a/crates/matrix-sdk-ui/src/timeline/inner/state.rs b/crates/matrix-sdk-ui/src/timeline/inner/state.rs index 2e5cf85e6..96e7b1b18 100644 --- a/crates/matrix-sdk-ui/src/timeline/inner/state.rs +++ b/crates/matrix-sdk-ui/src/timeline/inner/state.rs @@ -347,12 +347,6 @@ impl TimelineInnerState { Ok(()) } - pub(super) fn set_fully_read_event(&mut self, fully_read_event_id: OwnedEventId) { - let mut txn = self.transaction(); - txn.set_fully_read_event(fully_read_event_id); - txn.commit(); - } - #[cfg(test)] pub(super) fn handle_read_receipts( &mut self, diff --git a/crates/matrix-sdk-ui/src/timeline/tests/virt.rs b/crates/matrix-sdk-ui/src/timeline/tests/virt.rs index 8c45591da..79129a0de 100644 --- a/crates/matrix-sdk-ui/src/timeline/tests/virt.rs +++ b/crates/matrix-sdk-ui/src/timeline/tests/virt.rs @@ -106,7 +106,7 @@ async fn test_update_read_marker() { let day_divider = assert_next_matches!(stream, VectorDiff::PushFront { value } => value); assert!(day_divider.is_day_divider()); - timeline.inner.set_fully_read_event(first_event_id.clone()).await; + timeline.inner.handle_fully_read_marker(first_event_id.clone()).await; // Nothing should happen, the marker cannot be added at the end. @@ -118,7 +118,7 @@ async fn test_update_read_marker() { let item = assert_next_matches!(stream, VectorDiff::Insert { index: 2, value } => value); assert_matches!(item.as_virtual(), Some(VirtualTimelineItem::ReadMarker)); - timeline.inner.set_fully_read_event(second_event_id.clone()).await; + timeline.inner.handle_fully_read_marker(second_event_id.clone()).await; // The read marker is removed but not reinserted, because it cannot be added at // the end. @@ -133,20 +133,20 @@ async fn test_update_read_marker() { assert_matches!(marker.kind, TimelineItemKind::Virtual(VirtualTimelineItem::ReadMarker)); // Nothing should happen if the fully read event is set back to an older event. - timeline.inner.set_fully_read_event(first_event_id).await; + timeline.inner.handle_fully_read_marker(first_event_id).await; // Nothing should happen if the fully read event isn't found. - timeline.inner.set_fully_read_event(event_id!("$fake_event_id").to_owned()).await; + timeline.inner.handle_fully_read_marker(event_id!("$fake_event_id").to_owned()).await; // Nothing should happen if the fully read event is referring to an event // that has already been marked as fully read. - timeline.inner.set_fully_read_event(second_event_id).await; + timeline.inner.handle_fully_read_marker(second_event_id).await; timeline.handle_live_message_event(&ALICE, RoomMessageEventContent::text_plain("D")).await; let item = assert_next_matches!(stream, VectorDiff::PushBack { value } => value); item.as_event().unwrap(); - timeline.inner.set_fully_read_event(third_event_id).await; + timeline.inner.handle_fully_read_marker(third_event_id).await; // The read marker is moved after the third event. assert_next_matches!(stream, VectorDiff::Remove { index: 3 });