Split app/core up into domain-oriented files

This commit is contained in:
Jon Staab
2026-06-08 15:33:38 -07:00
parent ea6b63de53
commit 926b31de78
171 changed files with 2902 additions and 2628 deletions
+37
View File
@@ -0,0 +1,37 @@
import type {TrustedEvent} from "@welshman/util"
import {REACTION, getTag, makeEvent} from "@welshman/util"
import {publishThunk, tagEventForReaction} from "@welshman/app"
import {PROTECTED} from "@app/groups"
export type ReactionParams = {
protect: boolean
event: TrustedEvent
content: string
url?: string
tags?: string[][]
}
export const makeReaction = ({
url,
protect,
content,
event,
tags: paramTags = [],
}: ReactionParams) => {
const tags = [...paramTags, ...tagEventForReaction(event, url)]
const groupTag = getTag("h", event.tags)
if (groupTag) {
tags.push(groupTag)
}
if (protect) {
tags.push(PROTECTED)
}
return makeEvent(REACTION, {content, tags})
}
export const publishReaction = ({relays, ...params}: ReactionParams & {relays: string[]}) => {
publishThunk({event: makeReaction({url: relays[0], ...params}), relays})
}