diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt index 280610437e..0bf36b854a 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewModel.kt @@ -189,9 +189,11 @@ class RoomDetailViewModel @AssistedInject constructor( observeActiveRoomWidgets() observePowerLevel() room.getRoomSummaryLive() - if (!vectorPreferences.loadRoomAtFirstUnread()) { - viewModelScope.launch(Dispatchers.IO) { + viewModelScope.launch(Dispatchers.IO) { + if (!vectorPreferences.loadRoomAtFirstUnread()) { tryOrNull { room.markAsRead(ReadService.MarkAsReadParams.READ_RECEIPT) } + } else { + tryOrNull { room.setMarkedUnread(false) } } } // Inform the SDK that the room is displayed