feat: add nsfw toggle to post editor

This commit is contained in:
codytseng
2025-06-27 22:55:21 +08:00
parent 544d65972a
commit 5df33837ab
11 changed files with 94 additions and 88 deletions

View File

@@ -68,6 +68,7 @@ export async function createShortTextNoteDraftEvent(
parentEvent?: Event
addClientTag?: boolean
protectedEvent?: boolean
isNsfw?: boolean
} = {}
): Promise<TDraftEvent> {
const { quoteEventIds, rootETag, parentETag } = await extractRelatedEventIds(
@@ -103,6 +104,10 @@ export async function createShortTextNoteDraftEvent(
tags.push(['client', 'jumble'])
}
if (options.isNsfw) {
tags.push(['content-warning', 'NSFW'])
}
if (options.protectedEvent) {
tags.push(['-'])
}
@@ -182,6 +187,7 @@ export async function createCommentDraftEvent(
options: {
addClientTag?: boolean
protectedEvent?: boolean
isNsfw?: boolean
} = {}
): Promise<TDraftEvent> {
const {
@@ -241,6 +247,10 @@ export async function createCommentDraftEvent(
tags.push(['client', 'jumble'])
}
if (options.isNsfw) {
tags.push(['content-warning', 'NSFW'])
}
if (options.protectedEvent) {
tags.push(['-'])
}