Skip to content

Commit 0cb9d86

Browse files
authored
Send read receipts using the current timeline, not the live timeline (#5731)
This fixes sending read receipts in threaded timelines.
1 parent ee49e8f commit 0cb9d86

File tree

1 file changed

+6
-2
lines changed
  • features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline

1 file changed

+6
-2
lines changed

features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelinePresenter.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,17 @@ class TimelinePresenter(
389389
) = launch(dispatchers.computation) {
390390
// If we are at the bottom of timeline, we mark the room as read.
391391
if (firstVisibleIndex == 0) {
392-
room.liveTimeline.markAsRead(receiptType = readReceiptType)
392+
timelineController.invokeOnCurrentTimeline {
393+
markAsRead(receiptType = readReceiptType)
394+
}
393395
} else {
394396
// Get last valid EventId seen by the user, as the first index might refer to a Virtual item
395397
val eventId = getLastEventIdBeforeOrAt(firstVisibleIndex, timelineItems)
396398
if (eventId != null && eventId != lastReadReceiptId.value) {
397399
lastReadReceiptId.value = eventId
398-
room.liveTimeline.sendReadReceipt(eventId = eventId, receiptType = readReceiptType)
400+
timelineController.invokeOnCurrentTimeline {
401+
sendReadReceipt(eventId = eventId, receiptType = readReceiptType)
402+
}
399403
}
400404
}
401405
}

0 commit comments

Comments
 (0)