Merge pull request #6550 from element-hq/feature/bma/markAsFullyRead

Ensure mark as fully read is called only once when leaving the timeline
This commit is contained in:
Benoit Marty 2026-04-09 12:16:58 +02:00 committed by GitHub
commit 335d59179b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -250,12 +250,11 @@ class MessagesPresenter(
is MessagesEvent.OnUserClicked -> {
roomMemberModerationState.eventSink(RoomMemberModerationEvents.ShowActionsForUser(event.user))
}
is MessagesEvent.MarkAsFullyReadAndExit -> coroutineScope.launch {
if (!markingAsReadAndExiting.getAndSet(true)) {
is MessagesEvent.MarkAsFullyReadAndExit -> if (!markingAsReadAndExiting.getAndSet(true)) {
coroutineScope.launch {
val latestEventId = room.liveTimeline.getLatestEventId().getOrElse {
Timber.w(it, "Failed to get latest event id to mark as fully read")
navigator.close()
return@launch
null
}
latestEventId?.let { eventId ->
sessionCoroutineScope.launch {
@ -263,7 +262,6 @@ class MessagesPresenter(
}
}
navigator.close()
markingAsReadAndExiting.set(false)
}
}
}