mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-06-10 09:24:20 -04:00
feat(ui): TimelineFocusKind::PinnedEvents now uses PinnedEventsCache.
This patch updates `TimelineFocusKind::PinnedEvents { event_cache }` to
use a `PinnedEventsCache` instead of a `RoomEventCache`.
This commit is contained in:
@@ -27,8 +27,8 @@ use imbl::Vector;
|
||||
use matrix_sdk::{
|
||||
deserialized_responses::TimelineEvent,
|
||||
event_cache::{
|
||||
DecryptionRetryRequest, EventCache, EventFocusedCache, PaginationStatus, RoomEventCache,
|
||||
ThreadEventCache, TimelineVectorDiffs,
|
||||
DecryptionRetryRequest, EventCache, EventFocusedCache, PaginationStatus, PinnedEventsCache,
|
||||
RoomEventCache, ThreadEventCache, TimelineVectorDiffs,
|
||||
},
|
||||
send_queue::{
|
||||
LocalEcho, LocalEchoContent, RoomSendQueueUpdate, SendHandle, SendReactionHandle,
|
||||
@@ -148,7 +148,7 @@ pub(in crate::timeline) enum TimelineFocusKind {
|
||||
|
||||
PinnedEvents {
|
||||
/// The cache holding all the events for this focus.
|
||||
event_cache: RoomEventCache,
|
||||
event_cache: PinnedEventsCache,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -395,9 +395,9 @@ impl<P: RoomDataProvider> TimelineController<P> {
|
||||
root_event_id: root_event_id.clone(),
|
||||
},
|
||||
|
||||
TimelineFocus::PinnedEvents => {
|
||||
TimelineFocusKind::PinnedEvents { event_cache: event_cache.room(room_id).await?.0 }
|
||||
}
|
||||
TimelineFocus::PinnedEvents => TimelineFocusKind::PinnedEvents {
|
||||
event_cache: event_cache.pinned_events(room_id).await?.0,
|
||||
},
|
||||
};
|
||||
|
||||
let focus = Arc::new(focus);
|
||||
@@ -1447,8 +1447,7 @@ impl TimelineController {
|
||||
}
|
||||
|
||||
TimelineFocusKind::PinnedEvents { event_cache } => {
|
||||
let (initial_events, pinned_events_recv) =
|
||||
event_cache.subscribe_to_pinned_events().await?;
|
||||
let (initial_events, pinned_events_recv) = event_cache.subscribe().await?;
|
||||
|
||||
let has_events = !initial_events.is_empty();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::collections::BTreeSet;
|
||||
|
||||
use matrix_sdk::{
|
||||
event_cache::{
|
||||
EventFocusThreadMode, EventFocusedCache, EventsOrigin, RoomEventCache,
|
||||
EventFocusThreadMode, EventFocusedCache, EventsOrigin, PinnedEventsCache, RoomEventCache,
|
||||
RoomEventCacheSubscriber, RoomEventCacheUpdate, ThreadEventCache, TimelineVectorDiffs,
|
||||
},
|
||||
send_queue::RoomSendQueueUpdate,
|
||||
@@ -38,7 +38,7 @@ use crate::timeline::{TimelineController, TimelineFocus, event_item::RemoteEvent
|
||||
)
|
||||
)]
|
||||
pub(in crate::timeline) async fn pinned_events_task(
|
||||
room_event_cache: RoomEventCache,
|
||||
pinned_events_cache: PinnedEventsCache,
|
||||
timeline_controller: TimelineController,
|
||||
mut pinned_events_recv: Receiver<TimelineVectorDiffs>,
|
||||
) {
|
||||
@@ -54,8 +54,7 @@ pub(in crate::timeline) async fn pinned_events_task(
|
||||
// The updates might have lagged, but the room event cache might have
|
||||
// events, so retrieve them and add them back again to the timeline,
|
||||
// after clearing it.
|
||||
let (initial_events, _) = match room_event_cache.subscribe_to_pinned_events().await
|
||||
{
|
||||
let (initial_events, _) = match pinned_events_cache.subscribe().await {
|
||||
Ok(initial_events) => initial_events,
|
||||
Err(err) => {
|
||||
error!(
|
||||
|
||||
Reference in New Issue
Block a user