diff --git a/src/components/NoteStats/LikeButton.tsx b/src/components/NoteStats/LikeButton.tsx
index 3947761d..d52ba9c8 100644
--- a/src/components/NoteStats/LikeButton.tsx
+++ b/src/components/NoteStats/LikeButton.tsx
@@ -1,4 +1,5 @@
import { createReactionDraftEvent } from '@/lib/draft-event'
+import { isProtectedEvent } from '@/lib/event'
import { cn } from '@/lib/utils'
import { useNostr } from '@/providers/NostrProvider'
import { useNoteStats } from '@/providers/NoteStatsProvider'
@@ -54,7 +55,13 @@ export default function LikeButton({
const targetRelayList = await client.fetchRelayList(event.pubkey)
const reaction = createReactionDraftEvent(event)
- await publish(reaction, { additionalRelayUrls: targetRelayList.read.slice(0, 3) })
+ const isProtected = isProtectedEvent(event)
+ if (isProtected) {
+ const seenOn = client.getSeenEventRelayUrls(event.id)
+ await publish(reaction, { specifiedRelayUrls: seenOn })
+ } else {
+ await publish(reaction, { additionalRelayUrls: targetRelayList.read.slice(0, 3) })
+ }
markNoteAsLiked(event.id)
} catch (error) {
console.error('like failed', error)
diff --git a/src/components/PostEditor/NormalPostContent.tsx b/src/components/PostEditor/NormalPostContent.tsx
index 52ff354a..4b2e201a 100644
--- a/src/components/PostEditor/NormalPostContent.tsx
+++ b/src/components/PostEditor/NormalPostContent.tsx
@@ -12,6 +12,7 @@ import TextareaWithMentions from '../TextareaWithMentions.tsx'
import Mentions from './Mentions'
import PostOptions from './PostOptions.tsx'
import Preview from './Preview'
+import SendOnlyToSwitch from './SendOnlyToSwitch.tsx'
import { TPostOptions } from './types.ts'
import Uploader from './Uploader'
@@ -110,6 +111,11 @@ export default function NormalPostContent({
placeholder={t('Write something...')}
/>
{content && }
+
void }) {
textValue={content}
placeholder={t('Write something...')}
/>
+
)
}
diff --git a/src/components/PostEditor/SendOnlyToSwitch.tsx b/src/components/PostEditor/SendOnlyToSwitch.tsx
new file mode 100644
index 00000000..d6db868a
--- /dev/null
+++ b/src/components/PostEditor/SendOnlyToSwitch.tsx
@@ -0,0 +1,63 @@
+import { Label } from '@/components/ui/label'
+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
+import { Switch } from '@/components/ui/switch'
+import { isProtectedEvent } from '@/lib/event'
+import { simplifyUrl } from '@/lib/url'
+import { useFeed } from '@/providers/FeedProvider'
+import { Info } from 'lucide-react'
+import { Event } from 'nostr-tools'
+import { Dispatch, SetStateAction, useEffect } from 'react'
+import { useTranslation } from 'react-i18next'
+import { TPostOptions } from './types'
+
+export default function SendOnlyToSwitch({
+ parentEvent,
+ postOptions,
+ setPostOptions
+}: {
+ parentEvent?: Event
+ postOptions: TPostOptions
+ setPostOptions: Dispatch>
+}) {
+ const { t } = useTranslation()
+ const { relayUrls } = useFeed()
+
+ useEffect(() => {
+ const isProtected = parentEvent ? isProtectedEvent(parentEvent) : false
+ if (isProtected) {
+ setPostOptions((prev) => ({ ...prev, sendOnlyToCurrentRelays: true }))
+ }
+ }, [])
+
+ return (
+
+
+
+ {relayUrls.length > 1 && (
+
+
+
+
+
+ {relayUrls.map((url) => (
+ {simplifyUrl(url)}
+ ))}
+
+
+ )}
+
+
+ setPostOptions((prev) => ({ ...prev, sendOnlyToCurrentRelays: checked }))
+ }
+ />
+
+ )
+}
diff --git a/src/lib/draft-event.ts b/src/lib/draft-event.ts
index 31baa97b..629f3c3c 100644
--- a/src/lib/draft-event.ts
+++ b/src/lib/draft-event.ts
@@ -9,6 +9,7 @@ import {
extractImagesFromContent,
extractMentions,
getEventCoordinate,
+ isProtectedEvent,
isReplaceable
} from './event'
@@ -25,6 +26,10 @@ export function createReactionDraftEvent(event: Event): TDraftEvent {
tags.push(hint ? ['a', getEventCoordinate(event), hint] : ['a', getEventCoordinate(event)])
}
+ if (isProtectedEvent(event)) {
+ tags.push(['-'])
+ }
+
return {
kind: kinds.Reaction,
content: '+',