Add all rooms to notifications

This commit is contained in:
Jon Staab
2026-03-25 13:44:25 -07:00
parent 090070d1f9
commit 2b9b4da2cc
+9 -9
View File
@@ -2,10 +2,10 @@ import {derived} from "svelte/store"
import {Badge} from "@capawesome/capacitor-badge" import {Badge} from "@capawesome/capacitor-badge"
import {synced, throttled, withGetter} from "@welshman/store" import {synced, throttled, withGetter} from "@welshman/store"
import {pubkey, tracker, repository, relaysByUrl} from "@welshman/app" import {pubkey, tracker, repository, relaysByUrl} from "@welshman/app"
import {assoc, prop, spec, first, identity, now} from "@welshman/lib" import {assoc, prop, first, identity, groupBy, now} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util" import type {TrustedEvent} from "@welshman/util"
import {deriveEventsByIdByUrl} from "@welshman/store" import {deriveEventsByIdByUrl} from "@welshman/store"
import {sortEventsDesc} from "@welshman/util" import {sortEventsDesc, getTagValue} from "@welshman/util"
import {makeSpacePath, makeRoomPath, makeSpaceChatPath, makeChatPath} from "@app/util/routes" import {makeSpacePath, makeRoomPath, makeSpaceChatPath, makeChatPath} from "@app/util/routes"
import { import {
MESSAGE_KINDS, MESSAGE_KINDS,
@@ -13,7 +13,6 @@ import {
chatsById, chatsById,
userGroupList, userGroupList,
getSpaceUrlsFromGroupList, getSpaceUrlsFromGroupList,
getSpaceRoomsFromGroupList,
makeCommentFilter, makeCommentFilter,
hasNip29, hasNip29,
} from "@app/core/state" } from "@app/core/state"
@@ -121,13 +120,14 @@ export const allNotifications = derived(
const events = sortEventsDesc((eventsByIdByUrl.get(url) || new Map()).values()) const events = sortEventsDesc((eventsByIdByUrl.get(url) || new Map()).values())
if (hasNip29($relaysByUrl.get(url))) { if (hasNip29($relaysByUrl.get(url))) {
for (const h of getSpaceRoomsFromGroupList(url, $userGroupList)) { for (const [h, [latestEvent]] of groupBy(e => getTagValue("h", e.tags), events)) {
const roomPath = makeRoomPath(url, h) if (h) {
const latestEvent = events.find(e => e.tags.some(spec(["h", h]))) const roomPath = makeRoomPath(url, h)
if (hasNotification(roomPath, latestEvent)) { if (hasNotification(roomPath, latestEvent)) {
paths.add(spacePath) paths.add(spacePath)
paths.add(roomPath) paths.add(roomPath)
}
} }
} }
} else { } else {