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:
commit
02c5e6daa8
1 changed files with 3 additions and 5 deletions
|
|
@ -250,12 +250,11 @@ class MessagesPresenter(
|
||||||
is MessagesEvent.OnUserClicked -> {
|
is MessagesEvent.OnUserClicked -> {
|
||||||
roomMemberModerationState.eventSink(RoomMemberModerationEvents.ShowActionsForUser(event.user))
|
roomMemberModerationState.eventSink(RoomMemberModerationEvents.ShowActionsForUser(event.user))
|
||||||
}
|
}
|
||||||
is MessagesEvent.MarkAsFullyReadAndExit -> coroutineScope.launch {
|
is MessagesEvent.MarkAsFullyReadAndExit -> if (!markingAsReadAndExiting.getAndSet(true)) {
|
||||||
if (!markingAsReadAndExiting.getAndSet(true)) {
|
coroutineScope.launch {
|
||||||
val latestEventId = room.liveTimeline.getLatestEventId().getOrElse {
|
val latestEventId = room.liveTimeline.getLatestEventId().getOrElse {
|
||||||
Timber.w(it, "Failed to get latest event id to mark as fully read")
|
Timber.w(it, "Failed to get latest event id to mark as fully read")
|
||||||
navigator.close()
|
null
|
||||||
return@launch
|
|
||||||
}
|
}
|
||||||
latestEventId?.let { eventId ->
|
latestEventId?.let { eventId ->
|
||||||
sessionCoroutineScope.launch {
|
sessionCoroutineScope.launch {
|
||||||
|
|
@ -263,7 +262,6 @@ class MessagesPresenter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
navigator.close()
|
navigator.close()
|
||||||
markingAsReadAndExiting.set(false)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue