Ensure Mark as fully read is not invoked several times.

This commit is contained in:
Benoit Marty 2026-04-08 17:15:04 +02:00
parent 6cbd1b3486
commit d17992abe8

View file

@ -250,8 +250,8 @@ 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()
@ -263,7 +263,6 @@ class MessagesPresenter(
}
}
navigator.close()
markingAsReadAndExiting.set(false)
}
}
}