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 type {RsvpStatus} from "@welshman/domain"
|
||||||
import {synced} from "@welshman/store"
|
import {synced} from "@welshman/store"
|
||||||
import {deletes, events, reader, relays, thunks, writer} from "@app/core"
|
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"
|
import {kv} from "@app/storage"
|
||||||
|
|
||||||
// Views
|
// 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.
|
// 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) => {
|
export const publishRsvp = async (url: string, event: TrustedEvent, status: RsvpStatus) => {
|
||||||
const eventWriter = await toSpace(
|
const eventWriter = await addressWriterToSpace(
|
||||||
writer(CalendarRsvp)
|
writer(CalendarRsvp)
|
||||||
.setIdentifier(getAddress(event))
|
.setIdentifier(getAddress(event))
|
||||||
.setCalendarEventFromEvent(event, url)
|
.setCalendarEventFromEvent(event, url)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
import {makeEditor} from "@app/editor"
|
import {makeEditor} from "@app/editor"
|
||||||
import {command, writer} from "@app/core"
|
import {command, writer} from "@app/core"
|
||||||
import {pinToReference, setPinReference} from "@app/pinboards"
|
import {pinToReference, setPinReference} from "@app/pinboards"
|
||||||
import {toSpace} from "@app/rooms"
|
import {addressWriterToSpace} from "@app/rooms"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
import {clearModals} from "@app/modal"
|
import {clearModals} from "@app/modal"
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
const back = () => history.back()
|
const back = () => history.back()
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
const eventWriter = await toSpace(
|
const eventWriter = await addressWriterToSpace(
|
||||||
address ? writer(Pin).setIdentifier().addBoard(address) : writer(Pin, pin),
|
address ? writer(Pin).setIdentifier().addBoard(address) : writer(Pin, pin),
|
||||||
url,
|
url,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
import ModalFooter from "@lib/components/ModalFooter.svelte"
|
||||||
import RelayName from "@app/components/RelayName.svelte"
|
import RelayName from "@app/components/RelayName.svelte"
|
||||||
import {command, writer} from "@app/core"
|
import {command, writer} from "@app/core"
|
||||||
import {toSpace} from "@app/rooms"
|
import {addressWriterToSpace} from "@app/rooms"
|
||||||
import {makeLibraryPath} from "@app/routes"
|
import {makeLibraryPath} from "@app/routes"
|
||||||
import {pushToast} from "@app/toast"
|
import {pushToast} from "@app/toast"
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
loading = true
|
loading = true
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const eventWriter = await toSpace(
|
const eventWriter = await addressWriterToSpace(
|
||||||
writer(Pinboard, board).setTitle(title).setDescription(description),
|
writer(Pinboard, board).setTitle(title).setDescription(description),
|
||||||
url,
|
url,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
deriveUserRoomMembershipStatus,
|
deriveUserRoomMembershipStatus,
|
||||||
getRoomType,
|
getRoomType,
|
||||||
prependParent,
|
prependParent,
|
||||||
toSpace,
|
addressWriterToSpace,
|
||||||
} from "@app/rooms"
|
} from "@app/rooms"
|
||||||
import {loadSendDelay} from "@app/settings"
|
import {loadSendDelay} from "@app/settings"
|
||||||
import {deferredRoomPath, setChecked} from "@app/notifications"
|
import {deferredRoomPath, setChecked} from "@app/notifications"
|
||||||
|
|
@ -117,7 +117,7 @@
|
||||||
;({content, tags} = await prependParent(share, {content, tags}, url))
|
;({content, tags} = await prependParent(share, {content, tags}, url))
|
||||||
}
|
}
|
||||||
|
|
||||||
const eventWriter = await toSpace(
|
const eventWriter = await addressWriterToSpace(
|
||||||
writer(Message)
|
writer(Message)
|
||||||
.setContent(content)
|
.setContent(content)
|
||||||
.addTags(...tags),
|
.addTags(...tags),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import {APP_DATA, sortEventsDesc, tagSpec, tagValues} from "@welshman/util"
|
||||||
import {AppData} from "@welshman/domain"
|
import {AppData} from "@welshman/domain"
|
||||||
import {Relays, publish} from "@welshman/app"
|
import {Relays, publish} from "@welshman/app"
|
||||||
import {command, events, fromApp, writer} from "@app/core"
|
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.
|
// 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"
|
export const FEATURED_CONTENT_D = "flotilla/featured-content"
|
||||||
|
|
@ -31,5 +31,5 @@ export const setFeaturedContent = async (url: string, content: string[]) => {
|
||||||
.setIdentifier(FEATURED_CONTENT_D)
|
.setIdentifier(FEATURED_CONTENT_D)
|
||||||
.addTags(...tags)
|
.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}
|
return {content, tags}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const toSpace = async <W extends EventWriter<BaseEventReader>>(
|
export const addressWriterToSpace = async <W extends EventWriter<BaseEventReader>>(
|
||||||
eventWriter: W,
|
eventWriter: W,
|
||||||
url: string,
|
url: string,
|
||||||
h?: string,
|
h?: string,
|
||||||
|
|
@ -115,7 +115,7 @@ export const publishRoomQuote = async ({
|
||||||
parent: TrustedEvent
|
parent: TrustedEvent
|
||||||
delay?: number
|
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({
|
return thunks.get().publish({
|
||||||
relays: [url],
|
relays: [url],
|
||||||
|
|
@ -135,7 +135,7 @@ export const publishComment = async ({
|
||||||
event: TrustedEvent
|
event: TrustedEvent
|
||||||
parent?: TrustedEvent
|
parent?: TrustedEvent
|
||||||
}) => {
|
}) => {
|
||||||
const eventWriter = await toSpace(
|
const eventWriter = await addressWriterToSpace(
|
||||||
writer(Comment)
|
writer(Comment)
|
||||||
.setContent(content)
|
.setContent(content)
|
||||||
.addTags(...tags)
|
.addTags(...tags)
|
||||||
|
|
@ -156,7 +156,7 @@ export const publishToSpace = async (
|
||||||
eventWriter: EventWriter<BaseEventReader>,
|
eventWriter: EventWriter<BaseEventReader>,
|
||||||
{url, h, shareToChat}: {url: string; h?: string; shareToChat?: boolean},
|
{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()
|
const error = await thunk.waitForError()
|
||||||
|
|
||||||
if (shareToChat && !error) {
|
if (shareToChat && !error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue