diff --git a/src/app/calendar.ts b/src/app/calendar.ts index d1994709..dbf080ce 100644 --- a/src/app/calendar.ts +++ b/src/app/calendar.ts @@ -15,7 +15,7 @@ import {CalendarRsvp, TimeEvent} from "@welshman/domain" import type {RsvpStatus} from "@welshman/domain" import {synced} from "@welshman/store" import {deletes, events, reader, relays, thunks, writer} from "@app/core" -import {toSpace} from "@app/rooms" +import {addressWriterToSpace} from "@app/rooms" import {kv} from "@app/storage" // Views @@ -259,7 +259,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 eventWriter = await toSpace( + const eventWriter = await addressWriterToSpace( writer(CalendarRsvp) .setIdentifier(getAddress(event)) .setCalendarEventFromEvent(event, url) diff --git a/src/app/components/PinSave.svelte b/src/app/components/PinSave.svelte index 135cfc4c..9e611e76 100644 --- a/src/app/components/PinSave.svelte +++ b/src/app/components/PinSave.svelte @@ -22,7 +22,7 @@ import {makeEditor} from "@app/editor" import {command, writer} from "@app/core" import {pinToReference, setPinReference} from "@app/pinboards" - import {toSpace} from "@app/rooms" + import {addressWriterToSpace} from "@app/rooms" import {pushToast} from "@app/toast" import {clearModals} from "@app/modal" @@ -46,7 +46,7 @@ const back = () => history.back() const submit = async () => { - const eventWriter = await toSpace( + const eventWriter = await addressWriterToSpace( address ? writer(Pin).setIdentifier().addBoard(address) : writer(Pin, pin), url, ) diff --git a/src/app/components/PinboardEdit.svelte b/src/app/components/PinboardEdit.svelte index 13797f17..18c8a872 100644 --- a/src/app/components/PinboardEdit.svelte +++ b/src/app/components/PinboardEdit.svelte @@ -17,7 +17,7 @@ import ModalFooter from "@lib/components/ModalFooter.svelte" import RelayName from "@app/components/RelayName.svelte" import {command, writer} from "@app/core" - import {toSpace} from "@app/rooms" + import {addressWriterToSpace} from "@app/rooms" import {makeLibraryPath} from "@app/routes" import {pushToast} from "@app/toast" @@ -34,7 +34,7 @@ loading = true try { - const eventWriter = await toSpace( + const eventWriter = await addressWriterToSpace( writer(Pinboard, board).setTitle(title).setDescription(description), url, ) diff --git a/src/app/components/RoomChat.svelte b/src/app/components/RoomChat.svelte index c6780e13..bb5e31cb 100644 --- a/src/app/components/RoomChat.svelte +++ b/src/app/components/RoomChat.svelte @@ -31,7 +31,7 @@ deriveUserRoomMembershipStatus, getRoomType, prependParent, - toSpace, + addressWriterToSpace, } from "@app/rooms" import {loadSendDelay} from "@app/settings" import {deferredRoomPath, setChecked} from "@app/notifications" @@ -117,7 +117,7 @@ ;({content, tags} = await prependParent(share, {content, tags}, url)) } - const eventWriter = await toSpace( + const eventWriter = await addressWriterToSpace( writer(Message) .setContent(content) .addTags(...tags), diff --git a/src/app/featured.ts b/src/app/featured.ts index 46ef50f0..03ee9b13 100644 --- a/src/app/featured.ts +++ b/src/app/featured.ts @@ -3,7 +3,7 @@ import {APP_DATA, sortEventsDesc, tagSpec, tagValues} from "@welshman/util" import {AppData} from "@welshman/domain" import {Relays, publish} from "@welshman/app" import {command, events, fromApp, writer} from "@app/core" -import {toSpace} from "@app/rooms" +import {addressWriterToSpace} from "@app/rooms" // NIP-78 app data from the pubkey the space's NIP-11 names, one ["content", ] tag per entry. export const FEATURED_CONTENT_D = "flotilla/featured-content" @@ -31,5 +31,5 @@ export const setFeaturedContent = async (url: string, content: string[]) => { .setIdentifier(FEATURED_CONTENT_D) .addTags(...tags) - return command(await toSpace(eventWriter, url)).then(publish) + return command(await addressWriterToSpace(eventWriter, url)).then(publish) } diff --git a/src/app/rooms.ts b/src/app/rooms.ts index 10c18143..83635045 100644 --- a/src/app/rooms.ts +++ b/src/app/rooms.ts @@ -88,7 +88,7 @@ export const prependParent = async ( return {content, tags} } -export const toSpace = async >( +export const addressWriterToSpace = async >( eventWriter: W, url: string, h?: string, @@ -115,7 +115,7 @@ export const publishRoomQuote = async ({ parent: TrustedEvent delay?: number }) => { - const eventWriter = await toSpace(writer(Message).setParent(parent), url, h) + const eventWriter = await addressWriterToSpace(writer(Message).setParent(parent), url, h) return thunks.get().publish({ relays: [url], @@ -135,7 +135,7 @@ export const publishComment = async ({ event: TrustedEvent parent?: TrustedEvent }) => { - const eventWriter = await toSpace( + const eventWriter = await addressWriterToSpace( writer(Comment) .setContent(content) .addTags(...tags) @@ -156,7 +156,7 @@ export const publishToSpace = async ( eventWriter: EventWriter, {url, h, shareToChat}: {url: string; h?: string; shareToChat?: boolean}, ) => { - const thunk = await command(await toSpace(eventWriter, url, h)).then(publish) + const thunk = await command(await addressWriterToSpace(eventWriter, url, h)).then(publish) const error = await thunk.waitForError() if (shareToChat && !error) {