diff --git a/src/app/components/SpaceMenu.svelte b/src/app/components/SpaceMenu.svelte
index b11b5cf7..f86e761c 100644
--- a/src/app/components/SpaceMenu.svelte
+++ b/src/app/components/SpaceMenu.svelte
@@ -49,7 +49,7 @@
deriveUserIsSpaceAdmin,
deriveEventsForUrl,
notificationSettings,
- deriveIsMuted,
+ deriveShouldNotify,
} from "@app/core/state"
import {setSpaceNotifications} from "@app/core/commands"
import {notifications} from "@app/util/notifications"
@@ -98,10 +98,10 @@
const addRoom = () => pushModal(RoomCreate, {url}, {replaceState})
- const isMuted = deriveIsMuted(url)
+ const shouldNotify = deriveShouldNotify(url)
const toggleSpaceNotifications = () => {
- setSpaceNotifications(url, !isMuted)
+ setSpaceNotifications(url, !$shouldNotify)
}
let showMenu = $state(false)
@@ -122,7 +122,7 @@
- {#if isMuted}
+ {#if $notificationSettings.push && !$shouldNotify}
{/if}
@@ -172,8 +172,8 @@
{#if $notificationSettings.push}
{:else}
diff --git a/src/app/components/SpaceMenuRoomItem.svelte b/src/app/components/SpaceMenuRoomItem.svelte
index c8a3f08d..0afef81a 100644
--- a/src/app/components/SpaceMenuRoomItem.svelte
+++ b/src/app/components/SpaceMenuRoomItem.svelte
@@ -6,7 +6,7 @@
import RoomNameWithImage from "@app/components/RoomNameWithImage.svelte"
import {makeRoomPath} from "@app/util/routes"
import {notifications} from "@app/util/notifications"
- import {deriveIsMuted} from "@app/core/state"
+ import {deriveShouldNotify} from "@app/core/state"
interface Props {
url: any
@@ -18,9 +18,9 @@
const {url, h, notify = false, replaceState = false}: Props = $props()
const path = makeRoomPath(url, h)
- const isSpaceMuted = deriveIsMuted(url)
- const isRoomMuted = deriveIsMuted(url, h)
- const showDifferenceIcon = $derived($isRoomMuted !== $isSpaceMuted)
+ const shouldNotifyForSpace = deriveShouldNotify(url)
+ const shouldNotifyForRoom = deriveShouldNotify(url, h)
+ const showDifferenceIcon = $derived($shouldNotifyForRoom !== $shouldNotifyForSpace)
{#if showDifferenceIcon}
-
+
{/if}
diff --git a/src/app/core/state.ts b/src/app/core/state.ts
index d02750c3..7cab800c 100644
--- a/src/app/core/state.ts
+++ b/src/app/core/state.ts
@@ -1002,8 +1002,7 @@ export const parseInviteLink = (invite: string): InviteData | undefined => {
// Hierarchical notification helpers
-export const isMuted = (url: string, h?: string) => {
- const {alerts} = getSettings()
+export const getShouldNotify = ({alerts}: SettingsValues, url: string, h?: string) => {
const pref = alerts.find(spec({url}))
if (!pref) return true
@@ -1012,5 +1011,7 @@ export const isMuted = (url: string, h?: string) => {
if (!pref.notify) return pref.exceptions.includes(h)
}
-export const deriveIsMuted = (url: string, h?: string) =>
- derived(userSettingsValues, () => isMuted(url, h))
+export const shouldNotify = (url: string, h?: string) => getShouldNotify(getSettings(), url, h)
+
+export const deriveShouldNotify = (url: string, h?: string) =>
+ derived(userSettingsValues, $settings => getShouldNotify($settings, url, h))
diff --git a/src/app/util/notifications.ts b/src/app/util/notifications.ts
index 8b5bfd4c..7d32eb3f 100644
--- a/src/app/util/notifications.ts
+++ b/src/app/util/notifications.ts
@@ -78,7 +78,7 @@ import {
getSpaceRoomsFromGroupList,
makeCommentFilter,
userSpaceUrls,
- isMuted,
+ shouldNotify,
device,
} from "@app/core/state"
import {kv} from "@app/core/storage"
@@ -286,7 +286,7 @@ export const onNotification = call(() => {
const h = getTagValue("h", event.tags)
- if (Array.from(tracker.getRelays(event.id)).every(url => isMuted(url, h))) {
+ if (Array.from(tracker.getRelays(event.id)).every(url => !shouldNotify(url, h))) {
continue
}