Skip to content

Commit

Permalink
TW-1656: Fix user can't mark as read / unread some chat conversation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored Apr 3, 2024
1 parent 629c2ab commit 66bffae
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/pages/chat_list/chat_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,19 @@ class ChatListController extends State<ChatList>
Future<void> toggleUnreadSelections() async {
await TwakeDialog.showFutureLoadingDialogFullScreen(
future: () async {
final markUnread = anySelectedRoomNotMarkedUnread;
final markUnreadAction = anySelectedRoomNotMarkedUnread;
for (final conversation in conversationSelectionNotifier.value) {
final room = activeClient.getRoomById(conversation.roomId)!;
if (room.markedUnread == markUnread) continue;
await activeClient
.getRoomById(conversation.roomId)!
.markUnread(markUnread);
if (room.markedUnread == markUnreadAction) {
if (room.isUnread) {
await room.setReadMarker(
room.lastEvent!.eventId,
mRead: room.lastEvent!.eventId,
);
}
}

await room.markUnread(markUnreadAction);
}
},
);
Expand Down

0 comments on commit 66bffae

Please sign in to comment.