From 0776befc172652478bc13653315df36bdc76f35b Mon Sep 17 00:00:00 2001 From: Coracle-Bot Date: Fri, 18 Sep 2026 18:08:00 +0000 Subject: [PATCH] Inline the room tag name to break the rooms/routes import cycle (#579) --- src/app/calendar.ts | 6 +++--- src/app/components/RoomItemMenu.svelte | 4 ++-- src/app/components/RoomItemMenuMobile.svelte | 4 ++-- src/app/rooms.ts | 2 -- src/app/routes.ts | 3 +-- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/app/calendar.ts b/src/app/calendar.ts index 1a3fd832..902d7f82 100644 --- a/src/app/calendar.ts +++ b/src/app/calendar.ts @@ -14,7 +14,7 @@ import {TimeEvent} from "@welshman/domain" import {synced} from "@welshman/store" import {deletes, reader, relays, thunks} from "@app/core" import {deriveEvents} from "@app/repository" -import {PROTECTED, ROOM} from "@app/rooms" +import {PROTECTED} from "@app/rooms" import {kv} from "@app/storage" // Views @@ -269,7 +269,7 @@ export const getRsvpsByStatus = (rsvps: TrustedEvent[]) => { // An RSVP is addressable, so identifying it by its target makes a new one supersede the old. export const publishRsvp = async (url: string, event: TrustedEvent, status: RsvpStatus) => { const address = getAddress(event) - const h = tagValue(tagSpec(ROOM), event.tags) + const h = tagValue(tagSpec("h"), event.tags) const tags = [ ["a", address, url], ["e", event.id, url], @@ -283,7 +283,7 @@ export const publishRsvp = async (url: string, event: TrustedEvent, status: Rsvp } if (h) { - tags.push([ROOM, h]) + tags.push(["h", h]) } return thunks.get().publish({relays: [url], event: makeEvent(EVENT_RSVP, {tags})}) diff --git a/src/app/components/RoomItemMenu.svelte b/src/app/components/RoomItemMenu.svelte index 69b2be60..e0fd0d92 100644 --- a/src/app/components/RoomItemMenu.svelte +++ b/src/app/components/RoomItemMenu.svelte @@ -20,7 +20,7 @@ import ThreadCreate from "@app/components/ThreadCreate.svelte" import {app, relayManagement, roomPinLists, user} from "@app/core" import {deriveSpaceSupportedMethods} from "@app/management" - import {ROOM, deriveUserIsRoomAdmin} from "@app/rooms" + import {deriveUserIsRoomAdmin} from "@app/rooms" import {shareEvent} from "@app/share" import {readAloud} from "@app/speech" import {pushModal} from "@app/modal" @@ -34,7 +34,7 @@ const {url, event, onClick}: Props = $props() - const h = tagValue(tagSpec(ROOM), event.tags) ?? "" + const h = tagValue(tagSpec("h"), event.tags) ?? "" const pinIds = $roomPinLists.pins(url, h).$ const supportedMethods = deriveSpaceSupportedMethods(url) const userIsRoomAdmin = deriveUserIsRoomAdmin(url, h) diff --git a/src/app/components/RoomItemMenuMobile.svelte b/src/app/components/RoomItemMenuMobile.svelte index 8c0cf7c4..7b05919e 100644 --- a/src/app/components/RoomItemMenuMobile.svelte +++ b/src/app/components/RoomItemMenuMobile.svelte @@ -28,7 +28,7 @@ import EventDeleteConfirm from "@app/components/EventDeleteConfirm.svelte" import ThreadCreate from "@app/components/ThreadCreate.svelte" import {reactions, relays, roomPinLists, user} from "@app/core" - import {ROOM, deriveUserIsRoomAdmin} from "@app/rooms" + import {deriveUserIsRoomAdmin} from "@app/rooms" import {ENABLE_ZAPS} from "@app/env" import {makeContentPath} from "@app/routes" import {shareEvent} from "@app/share" @@ -45,7 +45,7 @@ const {url, event, reply, edit}: Props = $props() - const h = tagValue(tagSpec(ROOM), event.tags) ?? "" + const h = tagValue(tagSpec("h"), event.tags) ?? "" const path = makeContentPath(url, event.kind, getIdOrAddress(event)) const pinIds = $roomPinLists.pins(url, h).$ const userIsRoomAdmin = deriveUserIsRoomAdmin(url, h) diff --git a/src/app/rooms.ts b/src/app/rooms.ts index 8ed88c85..e2618518 100644 --- a/src/app/rooms.ts +++ b/src/app/rooms.ts @@ -22,8 +22,6 @@ import { import {deriveUserIsSpaceStaff} from "@app/management" import {makeRoomPath} from "@app/routes" -export const ROOM = "h" - export const PROTECTED = ["-"] export enum RoomType { diff --git a/src/app/routes.ts b/src/app/routes.ts index 9e13ca60..345384e0 100644 --- a/src/app/routes.ts +++ b/src/app/routes.ts @@ -23,7 +23,6 @@ import {makeChatId} from "@app/chats" import {entityLink, PLATFORM_URL, PLATFORM_RELAYS} from "@app/env" import {decodeRelay, encodeRelay} from "@app/relays" import {DM_KINDS} from "@app/content" -import {ROOM} from "@app/rooms" import {navigate, pushModal} from "@app/modal" import ChatEnable from "@app/components/ChatEnable.svelte" @@ -113,7 +112,7 @@ export const goToHome = () => { // Content types, events export const makeMessagePath = (url: string, event: TrustedEvent) => { - const h = tagValue(tagSpec(ROOM), event.tags) + const h = tagValue(tagSpec("h"), event.tags) const path = h ? makeRoomPath(url, h) : makeSpaceChatPath(url) const qp = new URLSearchParams({at: String(event.created_at)})