From 5954ee18b7649956188cf410b435b2bf72dae06a Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 12 Aug 2024 14:33:20 +0200 Subject: [PATCH] pinned events(refactor): rename `event_with_config` to `fetch_event` The `with_config` is now redundant, and `fetch` makes it clear it's hitting network. --- crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs | 6 +++--- crates/matrix-sdk-ui/src/timeline/tests/mod.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs b/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs index 869f2fec4..cfea34886 100644 --- a/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs +++ b/crates/matrix-sdk-ui/src/timeline/pinned_events_loader.rs @@ -87,7 +87,7 @@ impl PinnedEventsLoader { let new_events = join_all(event_ids_to_request.into_iter().map(|event_id| { let provider = Arc::clone(&provider); async move { - match provider.event_with_config(&event_id, request_config).await { + match provider.fetch_event(&event_id, request_config).await { Ok(event) => Some(event), Err(err) => { warn!("error when loading pinned event: {err}"); @@ -124,7 +124,7 @@ impl PinnedEventsLoader { #[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)] pub trait PinnedEventsRoom: SendOutsideWasm + SyncOutsideWasm { /// Load a single room event. - async fn event_with_config( + async fn fetch_event( &self, event_id: &EventId, request_config: Option, @@ -143,7 +143,7 @@ pub trait PinnedEventsRoom: SendOutsideWasm + SyncOutsideWasm { #[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)] impl PinnedEventsRoom for Room { - async fn event_with_config( + async fn fetch_event( &self, event_id: &EventId, request_config: Option, diff --git a/crates/matrix-sdk-ui/src/timeline/tests/mod.rs b/crates/matrix-sdk-ui/src/timeline/tests/mod.rs index fbe5baaeb..3f9d5e46d 100644 --- a/crates/matrix-sdk-ui/src/timeline/tests/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/tests/mod.rs @@ -322,7 +322,7 @@ impl PaginableRoom for TestRoomDataProvider { #[cfg_attr(target_arch = "wasm32", async_trait::async_trait(?Send))] #[cfg_attr(not(target_arch = "wasm32"), async_trait::async_trait)] impl PinnedEventsRoom for TestRoomDataProvider { - async fn event_with_config( + async fn fetch_event( &self, _event_id: &EventId, _config: Option,