From 429d4a97eca5c74815a7331870caacb1153bf5cb Mon Sep 17 00:00:00 2001 From: Kelrap Date: Mon, 10 Jun 2024 13:24:58 -0400 Subject: [PATCH] Check for eventId match when selecting/deselecting --- lib/pages/chat/chat.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 4a204c404a..73a0447d5d 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -1327,9 +1327,18 @@ class ChatController extends State } // Pangea# if (!event.redacted) { - if (selectedEvents.contains(event)) { + // #Pangea + // If previous selectedEvent has same eventId, delete previous selectedEvent + final matches = + selectedEvents.where((e) => e.eventId == event.eventId).toList(); + if (matches.isNotEmpty) { + // if (selectedEvents.contains(event)) { + // Pangea# setState( - () => selectedEvents.remove(event), + // #Pangea + () => selectedEvents.remove(matches.first), + // () => selectedEvents.remove(event), + // Pangea# ); } else { setState(