Fix notifications not displaying when document is not focused (#1425)
authorAlliegaytor <61523203+Alliegaytor@users.noreply.github.com>
Sun, 24 Sep 2023 04:31:02 +0000 (14:31 +1000)
committerGitHub <noreply@github.com>
Sun, 24 Sep 2023 04:31:02 +0000 (10:01 +0530)
Allows notifications from the active room while app is not focused (e.g. tabbed out)

src/client/state/Notifications.js

index 13dd3e17283069eaeed47dd9378e39304a746fbf..09fa240e7acec2f32d3ccf73b45f61175cbfcfdc 100644 (file)
@@ -234,7 +234,7 @@ class Notifications extends EventEmitter {
     const actions = this.matrixClient.getPushActionsForEvent(mEvent);
     if (!actions?.notify) return;
 
-    if (navigation.selectedRoomId === room.roomId && document.visibilityState === 'visible') return;
+    if (navigation.selectedRoomId === room.roomId && document.hasFocus()) return;
 
     if (mEvent.isEncrypted()) {
       await mEvent.attemptDecryption(this.matrixClient.crypto);