From f853e75e2353145fea7b35ded7d7483502aadcbb Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Thu, 9 Jan 2025 16:18:34 +0100 Subject: [PATCH] chore(ui): move timeline/read_receipts to timeline/controller/read_receipts Read receipts only make sense in the context of the timeline controller. --- crates/matrix-sdk-ui/src/timeline/controller/mod.rs | 1 + .../src/timeline/{ => controller}/read_receipts.rs | 10 +++------- crates/matrix-sdk-ui/src/timeline/controller/state.rs | 4 ++-- crates/matrix-sdk-ui/src/timeline/mod.rs | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) rename crates/matrix-sdk-ui/src/timeline/{ => controller}/read_receipts.rs (98%) diff --git a/crates/matrix-sdk-ui/src/timeline/controller/mod.rs b/crates/matrix-sdk-ui/src/timeline/controller/mod.rs index faa4305ea7e..97f1b6df26e 100644 --- a/crates/matrix-sdk-ui/src/timeline/controller/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/controller/mod.rs @@ -86,6 +86,7 @@ use crate::{ }; mod observable_items; +mod read_receipts; mod state; /// Data associated to the current timeline focus. diff --git a/crates/matrix-sdk-ui/src/timeline/read_receipts.rs b/crates/matrix-sdk-ui/src/timeline/controller/read_receipts.rs similarity index 98% rename from crates/matrix-sdk-ui/src/timeline/read_receipts.rs rename to crates/matrix-sdk-ui/src/timeline/controller/read_receipts.rs index 00964de20be..0444a111143 100644 --- a/crates/matrix-sdk-ui/src/timeline/read_receipts.rs +++ b/crates/matrix-sdk-ui/src/timeline/controller/read_receipts.rs @@ -25,14 +25,10 @@ use tokio_stream::wrappers::WatchStream; use tracing::{debug, error, warn}; use super::{ - controller::{ - AllRemoteEvents, FullEventMeta, ObservableItemsTransaction, TimelineMetadata, - TimelineState, TimelineStateTransaction, - }, - traits::RoomDataProvider, - util::{rfind_event_by_id, RelativePosition}, - TimelineItem, + rfind_event_by_id, AllRemoteEvents, FullEventMeta, ObservableItemsTransaction, + RoomDataProvider, TimelineMetadata, TimelineState, }; +use crate::timeline::{controller::TimelineStateTransaction, util::RelativePosition, TimelineItem}; /// In-memory caches for read receipts. #[derive(Clone, Debug, Default)] diff --git a/crates/matrix-sdk-ui/src/timeline/controller/state.rs b/crates/matrix-sdk-ui/src/timeline/controller/state.rs index dffda89f6ce..4fa209759fc 100644 --- a/crates/matrix-sdk-ui/src/timeline/controller/state.rs +++ b/crates/matrix-sdk-ui/src/timeline/controller/state.rs @@ -49,6 +49,7 @@ use super::{ AllRemoteEvents, ObservableItems, ObservableItemsTransaction, ObservableItemsTransactionEntry, }, + read_receipts::ReadReceipts, DateDividerMode, HandleManyEventsResult, TimelineFocusKind, TimelineSettings, }; use crate::{ @@ -62,7 +63,6 @@ use crate::{ event_item::{PollState, RemoteEventOrigin, ResponseData}, item::TimelineUniqueId, reactions::Reactions, - read_receipts::ReadReceipts, traits::RoomDataProvider, util::{rfind_event_by_id, RelativePosition}, Profile, TimelineItem, TimelineItemKind, @@ -1058,7 +1058,7 @@ pub(in crate::timeline) struct TimelineMetadata { /// Read receipts related state. /// /// TODO: move this over to the event cache (see also #3058). - pub read_receipts: ReadReceipts, + pub(in crate::timeline::controller) read_receipts: ReadReceipts, } /// Maximum number of stash pending edits. diff --git a/crates/matrix-sdk-ui/src/timeline/mod.rs b/crates/matrix-sdk-ui/src/timeline/mod.rs index df2ce390a79..e8545d3f9ea 100644 --- a/crates/matrix-sdk-ui/src/timeline/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/mod.rs @@ -69,7 +69,6 @@ mod item; mod pagination; mod pinned_events_loader; mod reactions; -mod read_receipts; #[cfg(test)] mod tests; mod to_device;