This repository has been archived on 2026-10-25. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Sable/src
Evie Gauthier 35af55e611 fix(notifications): suppress OS notification when app is focused; wrap in try/catch
Two bugs caused in-app notifications to silently vanish on desktop when
the window was focused:

1. window.Notification() was called unconditionally even when the window
   had focus.  In some browsers/environments (certain Chrome versions,
   Electron, macOS DnD mode) calling the Notification constructor throws
   or is silently rejected when the tab is active.  Without a try/catch
   the uncaught exception aborted the entire RoomEvent.Timeline handler
   before setInAppBanner was ever reached — so neither the OS notification
   NOR the in-app banner appeared.  InviteNotifications already used
   try/catch for the same reason; MessageNotifications did not.

2. The OS notification was semantically wrong when focused: the in-app
   banner is the correct alert while the window is active.  Added a
   !document.hasFocus() guard to match the comment's stated intent
   ("alert when minimised or tab not active") and to prevent a duplicate
   OS+in-app banner when another window is simply on top.

Mobile is unaffected: mobileOrTablet() already gates the OS block.
The in-app banner path (visibilityState === 'visible' → setInAppBanner)
is unchanged and continues to fire correctly on both desktop (focused)
and mobile (app visible in browser).
2026-03-09 21:39:49 -04:00
..
2026-03-07 02:07:58 -06:00