Skip to content

Commit

Permalink
feat(sdk,ui): Add EventsOrigin::Pagination.
Browse files Browse the repository at this point in the history
This patch adds the `Pagination` variant to the `EventsOrigin` enum.
Not something really mandatory and that is likely to fix a bug, but it's
now correct.
  • Loading branch information
Hywan committed Jan 8, 2025
1 parent 3f977b7 commit 55e25a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion crates/matrix-sdk-ui/src/timeline/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,10 @@ impl TimelineBuilder {

inner.add_events_at(
events.into_iter(),
TimelineNewItemPosition::End { origin: match origin {
TimelineNewItemPosition::End {
origin: match origin {
EventsOrigin::Sync => RemoteEventOrigin::Sync,
EventsOrigin::Pagination => RemoteEventOrigin::Pagination,
}
}
).await;
Expand All @@ -313,6 +315,7 @@ impl TimelineBuilder {
diffs,
match origin {
EventsOrigin::Sync => RemoteEventOrigin::Sync,
EventsOrigin::Pagination => RemoteEventOrigin::Pagination,
}
).await;
}
Expand Down
3 changes: 3 additions & 0 deletions crates/matrix-sdk/src/event_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,9 @@ pub enum RoomEventCacheUpdate {
pub enum EventsOrigin {
/// Events are coming from a sync.
Sync,

/// Events are coming from pagination.
Pagination,
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/src/event_cache/pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl RoomPagination {
if !updates_as_vector_diffs.is_empty() {
let _ = self.inner.sender.send(RoomEventCacheUpdate::UpdateTimelineEvents {
diffs: updates_as_vector_diffs,
origin: EventsOrigin::Sync,
origin: EventsOrigin::Pagination,
});
}

Expand Down

0 comments on commit 55e25a3

Please sign in to comment.