From c463e0e2db375ffb5131daad62af2f7f3327c75e Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 28 Sep 2026 10:27:25 -0700 Subject: [PATCH] Rename isGroupSpace to spaceSupportsRooms --- .agents/skills/flotilla-model/SKILL.md | 2 +- src/app/components/SpaceMenuNavItems.svelte | 8 ++++---- src/app/components/SpaceMenuRooms.svelte | 6 +++--- src/app/notifications.ts | 6 +++--- src/app/relays.ts | 4 ++-- src/app/rooms.ts | 4 ++-- src/app/share.ts | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.agents/skills/flotilla-model/SKILL.md b/.agents/skills/flotilla-model/SKILL.md index 58dff5e4..b859daa4 100644 --- a/.agents/skills/flotilla-model/SKILL.md +++ b/.agents/skills/flotilla-model/SKILL.md @@ -41,7 +41,7 @@ domain `Relay`. These fields drive protocol decisions: | Read | Decides | |---|---| -| `hasNip(29)` | whether the space has rooms, read through `isGroupSpace(url)` / `deriveIsGroupSpace(url)` in `src/app/relays.ts`. Without it everything lives in the space chat (`makeSpaceChatPath`): `shareEvent` (`src/app/share.ts`), room search, notification grouping, `SpaceMenuNavItems`, `SpaceMenuRooms` | +| `hasNip(29)` | whether the space has rooms, read through `spaceSupportsRooms(url)` / `deriveSpaceSupportsRooms(url)` in `src/app/relays.ts`. Without it everything lives in the space chat (`makeSpaceChatPath`): `shareEvent` (`src/app/share.ts`), room search, notification grouping, `SpaceMenuNavItems`, `SpaceMenuRooms` | | `hasNip(70)` | whether space content is marked protected (below) | | `self` | the relay's own pubkey, the trust anchor for relay-signed state | | `pubkey` | the space's owner, who writes space-wide content that has no other author (`deriveUserIsSpaceOwner`) | diff --git a/src/app/components/SpaceMenuNavItems.svelte b/src/app/components/SpaceMenuNavItems.svelte index 705462df..9a7d1d85 100644 --- a/src/app/components/SpaceMenuNavItems.svelte +++ b/src/app/components/SpaceMenuNavItems.svelte @@ -20,7 +20,7 @@ import {events} from "@app/core" import {ENABLE_ZAPS} from "@app/env" import {CONTENT_KINDS} from "@app/content" - import {deriveIsGroupSpace} from "@app/relays" + import {deriveSpaceSupportsRooms} from "@app/relays" import {makeSpaceChatPath, makeSpacePath} from "@app/routes" import {allNotifications, notifications} from "@app/notifications" import {pushModal} from "@app/modal" @@ -31,7 +31,7 @@ const {url}: Props = $props() - const isGroupSpace = deriveIsGroupSpace(url) + const supportsRooms = deriveSpaceSupportsRooms(url) const chatPath = makeSpaceChatPath(url) const goalsPath = makeSpacePath(url, "goals") const threadsPath = makeSpacePath(url, "threads") @@ -62,7 +62,7 @@ Space Details -{#if !$isGroupSpace} +{#if !$supportsRooms} Chat @@ -105,7 +105,7 @@ Polls {/if} -{#if $isGroupSpace} +{#if $supportsRooms} Search diff --git a/src/app/components/SpaceMenuRooms.svelte b/src/app/components/SpaceMenuRooms.svelte index a2e1d93d..fba59ff4 100644 --- a/src/app/components/SpaceMenuRooms.svelte +++ b/src/app/components/SpaceMenuRooms.svelte @@ -9,7 +9,7 @@ import SpaceMenuRoomItem from "@app/components/SpaceMenuRoomItem.svelte" import RoomCreate from "@app/components/RoomCreate.svelte" import {deriveUserCanCreateRoom} from "@app/management" - import {deriveIsGroupSpace} from "@app/relays" + import {deriveSpaceSupportsRooms} from "@app/relays" import {RoomType, deriveUserRooms, deriveOtherRooms, displayRoom} from "@app/rooms" import {pushModal} from "@app/modal" @@ -20,7 +20,7 @@ const {url, mobile = false}: Props = $props() - const isGroupSpace = deriveIsGroupSpace(url) + const supportsRooms = deriveSpaceSupportsRooms(url) const userRooms = deriveUserRooms(url) const otherRooms = deriveOtherRooms(url, RoomType.Text) const otherVoiceRooms = deriveOtherRooms(url, RoomType.Voice) @@ -95,7 +95,7 @@ {/if} {/snippet} -{#if $isGroupSpace && ($userRooms.length > 0 || $otherRooms.length > 0 || $otherVoiceRooms.length > 0 || $canCreateRoom)} +{#if $supportsRooms && ($userRooms.length > 0 || $otherRooms.length > 0 || $otherVoiceRooms.length > 0 || $canCreateRoom)} {#if mobile}
{@render content()} diff --git a/src/app/notifications.ts b/src/app/notifications.ts index 88f8400e..2b7a17b2 100644 --- a/src/app/notifications.ts +++ b/src/app/notifications.ts @@ -26,7 +26,7 @@ import {CONTENT_KINDS, makeCommentFilter} from "@app/content" import {getIsMuted, userSettingsValues} from "@app/settings" import {Chats} from "@app/chats" import {dufflepud, DUFFLEPUD_URL} from "@app/env" -import {isGroupSpace} from "@app/relays" +import {spaceSupportsRooms} from "@app/relays" import {activeSpaceUrls} from "@app/rooms" import {getHttpAuthHeader} from "@app/signer" import {kv} from "@app/storage" @@ -214,7 +214,7 @@ export const latestActivityByPath = derived( [ activeSpaceUrls, fromApp($app => $app.use(Chats).index.$), - // Only here to recompute once a relay's NIP-11 says whether it's a group space + // Only here to recompute once a relay's NIP-11 says whether the space supports rooms fromApp($app => $app.use(Relays).index.$), fromApp( $app => @@ -240,7 +240,7 @@ export const latestActivityByPath = derived( for (const url of $activeSpaceUrls) { const events = sortEventsDesc((eventsByIdByUrl.get(url) || new Map()).values()) - if (isGroupSpace(url)) { + if (spaceSupportsRooms(url)) { for (const [h, [event]] of groupBy(e => tagValue(tagSpec("h"), e.tags), events)) { // A muted room is left out entirely, so it can't light up its own badge or the space's if (h && !getIsMuted($settings, url, h)) { diff --git a/src/app/relays.ts b/src/app/relays.ts index 2997b8a3..d5440c9e 100644 --- a/src/app/relays.ts +++ b/src/app/relays.ts @@ -94,9 +94,9 @@ export const deriveSocketStatus = (url: string) => ) // A space that isn't a NIP-29 relay has no rooms, only one space-wide chat. -export const isGroupSpace = (url: string) => Boolean(relays.get().get(url)?.hasNip(29)) +export const spaceSupportsRooms = (url: string) => Boolean(relays.get().get(url)?.hasNip(29)) -export const deriveIsGroupSpace = (url: string) => +export const deriveSpaceSupportsRooms = (url: string) => derived(relays.get().one(url), $relay => Boolean($relay?.hasNip(29))) const livekitUrl = (url: string) => diff --git a/src/app/rooms.ts b/src/app/rooms.ts index 2d5fc1ca..10c18143 100644 --- a/src/app/rooms.ts +++ b/src/app/rooms.ts @@ -22,7 +22,7 @@ import { } from "@app/core" import {PLATFORM_RELAYS} from "@app/env" import {allowPubkeys, deriveSpacePermissions, deriveUserIsSpaceStaff} from "@app/management" -import {isGroupSpace} from "@app/relays" +import {spaceSupportsRooms} from "@app/relays" import {makeRoomPath, makeSpaceChatPath} from "@app/routes" import {loadSendDelay} from "@app/settings" @@ -300,7 +300,7 @@ export const deriveUserRoomSearch = () => type Option = {url: string; h?: string; path: string; name: string; isFavorite: boolean} const options = $userSpaceUrls.flatMap((url): Option[] => { - if (isGroupSpace(url)) { + if (spaceSupportsRooms(url)) { const favorites = new Set($userRoomList?.roomsForUrl(url) ?? []) return ($roomsByUrl.get(url) ?? []).map(({h}) => ({ diff --git a/src/app/share.ts b/src/app/share.ts index 1e7fbcd2..cafb57dd 100644 --- a/src/app/share.ts +++ b/src/app/share.ts @@ -6,7 +6,7 @@ import type {Maybe} from "@welshman/lib" import type {TrustedEvent} from "@welshman/util" import {app} from "@app/core" import {navigate, pushModal} from "@app/modal" -import {isGroupSpace} from "@app/relays" +import {spaceSupportsRooms} from "@app/relays" import {makeSpaceChatPath} from "@app/routes" import {pushToast} from "@app/toast" import ShareDialog from "@app/components/Share.svelte" @@ -31,7 +31,7 @@ export const shareTo = async ( } export const shareEvent = (url: string, noun: string, event: TrustedEvent) => { - if (isGroupSpace(url)) { + if (spaceSupportsRooms(url)) { pushModal(ShareEvent, {url, noun, event}) } else { shareTo(makeSpaceChatPath(url), {type: "event", value: event})