Inline the room tag name to break the rooms/routes import cycle (#579)

This commit is contained in:
Coracle-Bot 2026-09-18 18:08:00 +00:00 committed by hodlbod
parent 2c980caa00
commit 0776befc17
5 changed files with 8 additions and 11 deletions

View file

@ -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})})

View file

@ -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)

View file

@ -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)

View file

@ -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 {

View file

@ -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)})