From 805d5bd97b45db521e9d1cd7825abd9b6f3a17f2 Mon Sep 17 00:00:00 2001
From: Ajay Bura <32841439+ajbura@users.noreply.github.com>
Date: Sun, 4 Aug 2024 10:50:42 +0530
Subject: [PATCH] fix notification not working for selected room

---
 src/app/pages/client/ClientNonUIFeatures.tsx   | 8 ++++----
 src/app/pages/client/sidebar/UnverifiedTab.tsx | 2 --
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/app/pages/client/ClientNonUIFeatures.tsx b/src/app/pages/client/ClientNonUIFeatures.tsx
index 845fceb3..ffe33e9a 100644
--- a/src/app/pages/client/ClientNonUIFeatures.tsx
+++ b/src/app/pages/client/ClientNonUIFeatures.tsx
@@ -183,17 +183,17 @@ function MessageNotifications() {
       removed,
       data
     ) => {
+      if (mx.getSyncState() !== 'SYNCING') return;
+      if (document.hasFocus() && (selectedRoomId === room?.roomId || notificationSelected)) return;
       if (
-        mx.getSyncState() !== 'SYNCING' ||
-        selectedRoomId === room?.roomId ||
-        notificationSelected ||
         !room ||
         !data.liveEvent ||
         room.isSpaceRoom() ||
         !isNotificationEvent(mEvent) ||
         getNotificationType(mx, room.roomId) === NotificationType.Mute
-      )
+      ) {
         return;
+      }
 
       const sender = mEvent.getSender();
       const eventId = mEvent.getId();
diff --git a/src/app/pages/client/sidebar/UnverifiedTab.tsx b/src/app/pages/client/sidebar/UnverifiedTab.tsx
index 402ffc2b..919c4a70 100644
--- a/src/app/pages/client/sidebar/UnverifiedTab.tsx
+++ b/src/app/pages/client/sidebar/UnverifiedTab.tsx
@@ -16,11 +16,9 @@ import * as css from './UnverifiedTab.css';
 export function UnverifiedTab() {
   const mx = useMatrixClient();
   const deviceList = useDeviceList();
-  console.log(deviceList);
   const unverified = deviceList?.filter(
     (device) => isCrossVerified(mx, device.device_id) === false
   );
-  console.log(unverified);
 
   if (!unverified?.length) return null;