Rename toSpace to addressWriterToSpace
This commit is contained in:
parent
cb425734a3
commit
4d4e736c5e
6 changed files with 14 additions and 14 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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", <value>] 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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export const prependParent = async (
|
|||
return {content, tags}
|
||||
}
|
||||
|
||||
export const toSpace = async <W extends EventWriter<BaseEventReader>>(
|
||||
export const addressWriterToSpace = async <W extends EventWriter<BaseEventReader>>(
|
||||
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<BaseEventReader>,
|
||||
{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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue