forked from coracle/flotilla
Split app/core up into domain-oriented files
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type {TrustedEvent} from "@welshman/util"
|
||||
import {REPORT, makeEvent} from "@welshman/util"
|
||||
import {publishThunk} from "@welshman/app"
|
||||
|
||||
export type ReportParams = {
|
||||
event: TrustedEvent
|
||||
content: string
|
||||
reason: string
|
||||
}
|
||||
|
||||
export const makeReport = ({event, reason, content}: ReportParams) => {
|
||||
const tags = [
|
||||
["p", event.pubkey],
|
||||
["e", event.id, reason],
|
||||
]
|
||||
|
||||
return makeEvent(REPORT, {content, tags})
|
||||
}
|
||||
|
||||
export const publishReport = ({
|
||||
relays,
|
||||
event,
|
||||
reason,
|
||||
content,
|
||||
}: ReportParams & {relays: string[]}) =>
|
||||
publishThunk({event: makeReport({event, reason, content}), relays})
|
||||
Reference in New Issue
Block a user