fix(notifications): in-app toasts no longer need browser notification permission (#324) #395

Merged
jared merged 1 commits from fix/inapp-toast-permission into lotus 2026-10-18 03:06:13 -04:00
+8 -2
View File
@@ -334,7 +334,9 @@ function InviteNotifications() {
if (quietActive) return; if (quietActive) return;
if (showNotifications && notificationPermission('granted')) { // [Gitea #324] The in-app toast (focused window) needs no browser
// permission; only the OS notification does.
if (showNotifications && (document.hasFocus() || notificationPermission('granted'))) {
notify(newCount); notify(newCount);
} }
if (notificationSound && inviteSoundId !== 'none') { if (notificationSound && inviteSoundId !== 'none') {
@@ -641,7 +643,11 @@ function MessageNotifications() {
if (quietActive) return; if (quietActive) return;
if (showNotifications && notificationPermission('granted')) { // [Gitea #324] notify() shows an in-app toast while the window is focused,
// which needs no browser permission; only its OS-notification path does.
// Gating both on the permission left people who declined it (most web
// users) with a ping sound and nothing on screen.
if (showNotifications && (document.hasFocus() || notificationPermission('granted'))) {
const avatarMxc = const avatarMxc =
room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl(); room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl();
notify({ notify({