-
Notifications
You must be signed in to change notification settings - Fork 289
timeline: add event focus mode for permalinks #3329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c6a32d3
to
96e1f4f
Compare
0c95063
to
fd6e21e
Compare
This introduces the `TimelineFocus`, a new enum to declare if the timeline is "live" aka looking at events from sync and displaying them as they come in, or focused on an event (e.g. after clicking a permalink). When in the second mode, the timeline can paginate forwards and backwards, without interacting with the event cache (as this would require some complicated reconciliation of known events with events received from pagination, with no guarantee that those events are event connected in whatever way). An event-focused timeline will also show edits/reactions/redactions in real-time (as the events are received from the sync), but will not show new timeline items, be they for local echoes or events received from the sync.
8ad2a8a
to
397a26e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3329 +/- ##
==========================================
+ Coverage 83.63% 83.64% +0.01%
==========================================
Files 242 242
Lines 24939 25016 +77
==========================================
+ Hits 20857 20924 +67
- Misses 4082 4092 +10 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work, well done!
let (events, mut event_subscriber) = room_event_cache.subscribe().await?; | ||
|
||
let has_events = !events.is_empty(); | ||
let (_, mut event_subscriber) = room_event_cache.subscribe().await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we explain why we drop events here?
/// | ||
/// Returns whether we hit the end of the timeline. | ||
#[instrument(skip_all)] | ||
pub async fn focused_paginate_forwards(&self, num_events: u16) -> Result<bool, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to keep this method private?
/// | ||
/// Returns whether we hit the start of the timeline. | ||
#[instrument(skip(self), fields(room_id = ?self.room().room_id()))] | ||
pub async fn focused_paginate_backwards(&self, num_events: u16) -> Result<bool, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to keep this method private?
#[instrument(skip_all, fields(room_id = ?self.room().room_id(), ?options))] | ||
pub async fn paginate_backwards( | ||
pub async fn live_paginate_backwards( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this renaming is necessary.
/// | ||
/// Returns whether we hit the end of the timeline or not. | ||
pub async fn paginate_forwards(&self, num_events: u16) -> Result<bool, ClientError> { | ||
Ok(self.inner.focused_paginate_forwards(num_events).await?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be simply paginate_forwards
?
Actually, there is a problem with the pagination code:
Finally, there is another problem:
|
Fixes #3234.
See the commit message of the first commit for more details. This is sufficient to implement pagination in the timeline.