-
Notifications
You must be signed in to change notification settings - Fork 358
fix(ui): Sending read receipt in live timeline uses threaded event id instead #5864
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
Changes from 6 commits
635313a
543eefb
6eec020
238f06e
487b842
92a3d3a
4e1f5b9
ee2eca3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1761,7 +1761,27 @@ impl TimelineController { | |
| /// it's folded into another timeline item. | ||
| pub(crate) async fn latest_event_id(&self) -> Option<OwnedEventId> { | ||
| let state = self.state.read().await; | ||
| state.items.all_remote_events().last().map(|event_meta| &event_meta.event_id).cloned() | ||
| let filter_out_thread_events = match self.focus() { | ||
| TimelineFocusKind::Thread { .. } => false, | ||
| TimelineFocusKind::Live { hide_threaded_events } => hide_threaded_events.to_owned(), | ||
| TimelineFocusKind::Event { paginator } => { | ||
| paginator.get().is_some_and(|paginator| paginator.hide_threaded_events()) | ||
| } | ||
| _ => true, | ||
| }; | ||
| state | ||
| .items | ||
| .all_remote_events() | ||
| .iter() | ||
| .rev() | ||
| .filter_map(|item| { | ||
| if !filter_out_thread_events || item.thread_root_id.is_none() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain with an inline comment here why we want to filter out event with a thread root? |
||
| Some(item.event_id.clone()) | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| .next() | ||
| } | ||
|
|
||
| #[instrument(skip(self), fields(room_id = ?self.room().room_id()))] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,7 +253,7 @@ impl Timeline { | |
| Some(item.to_owned()) | ||
| } | ||
|
|
||
| /// Get the latest of the timeline's event items. | ||
| /// Get the latest of the timeline's event items, both remote and local. | ||
| pub async fn latest_event(&self) -> Option<EventTimelineItem> { | ||
| if self.controller.is_live() { | ||
| self.controller.items().await.iter().rev().find_map(|item| { | ||
|
|
@@ -268,6 +268,11 @@ impl Timeline { | |
| } | ||
| } | ||
|
|
||
| /// Get the latest of the timeline's event ids. | ||
|
||
| pub async fn latest_event_id(&self) -> Option<OwnedEventId> { | ||
| self.controller.latest_event_id().await | ||
| } | ||
|
|
||
| /// Get the current timeline items, along with a stream of updates of | ||
| /// timeline items. | ||
| /// | ||
|
|
||
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.
Please add documentation for this field. Also —just a personal taste— I would put this field after
event_id, not mandatory.