Skip to content

Commit 885cceb

Browse files
committed
docs(timeline): clarify what mark_as_read actually does
Signed-off-by: Johannes Marbach <[email protected]>
1 parent 24d7518 commit 885cceb

File tree

2 files changed

+31
-12
lines changed
  • bindings/matrix-sdk-ffi/src/timeline
  • crates/matrix-sdk-ui/src/timeline

2 files changed

+31
-12
lines changed

bindings/matrix-sdk-ffi/src/timeline/mod.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,21 @@ impl Timeline {
354354
Ok(())
355355
}
356356

357-
/// Mark the room as read by trying to attach an *unthreaded* read receipt
358-
/// to the latest room event.
357+
/// Mark the timeline as read by attempting to send a read receipt on the
358+
/// latest visible event.
359359
///
360-
/// This works even if the latest event belongs to a thread, as a threaded
361-
/// reply also belongs to the unthreaded timeline. No threaded receipt
362-
/// will be sent here (see also #3123).
360+
/// The latest visible event is determined from the timeline's focus kind
361+
/// and whether or not it hides threaded events. If no latest event can
362+
/// be determined and the timeline is live, the room's unread marker is
363+
/// unset instead.
364+
///
365+
/// # Arguments
366+
///
367+
/// * `receipt_type` - The type of receipt to send. When using
368+
/// [`ReceiptType::FullyRead`], an unthreaded receipt will be sent. This
369+
/// works even if the latest event belongs to a thread, as a threaded
370+
/// reply also belongs to the unthreaded timeline. Otherwise the receipt
371+
/// thread will be determined based on the timeline's focus kind.
363372
pub async fn mark_as_read(&self, receipt_type: ReceiptType) -> Result<(), ClientError> {
364373
self.inner.mark_as_read(receipt_type.into()).await?;
365374
Ok(())

crates/matrix-sdk-ui/src/timeline/mod.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -788,16 +788,26 @@ impl Timeline {
788788
Ok(())
789789
}
790790

791-
/// Mark the room as read by sending an unthreaded read receipt on the
792-
/// latest event, be it visible or not.
791+
/// Mark the timeline as read by attempting to send a read receipt on the
792+
/// latest visible event.
793793
///
794-
/// This works even if the latest event belongs to a thread, as a threaded
795-
/// reply also belongs to the unthreaded timeline. No threaded receipt
796-
/// will be sent here (see also #3123).
794+
/// The latest visible event is determined from the timeline's focus kind
795+
/// and whether or not it hides threaded events. If no latest event can
796+
/// be determined and the timeline is live, the room's unread marker is
797+
/// unset instead.
797798
///
798-
/// This also unsets the unread marker of the room if necessary.
799+
/// # Arguments
799800
///
800-
/// Returns a boolean indicating if it sent the receipt or not.
801+
/// * `receipt_type` - The type of receipt to send. When using
802+
/// [`ReceiptType::FullyRead`], an unthreaded receipt will be sent. This
803+
/// works even if the latest event belongs to a thread, as a threaded
804+
/// reply also belongs to the unthreaded timeline. Otherwise the
805+
/// [`ReceiptThread`] will be determined based on the timeline's focus
806+
/// kind.
807+
///
808+
/// # Returns
809+
///
810+
/// A boolean indicating if the receipt was sent or not.
801811
#[instrument(skip(self), fields(room_id = ?self.room().room_id()))]
802812
pub async fn mark_as_read(&self, receipt_type: ReceiptType) -> Result<bool> {
803813
if let Some(event_id) = self.controller.latest_event_id().await {

0 commit comments

Comments
 (0)