From 596e782b65f765e35e5b4a011ee1d0ca9f400d73 Mon Sep 17 00:00:00 2001 From: en Date: Mon, 24 Feb 2025 15:43:53 +0100 Subject: [PATCH] fix(notes): correctly mark repost as nsfw --- src/components/Notes/Note.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/Notes/Note.tsx b/src/components/Notes/Note.tsx index 9e0652c..3d92fba 100644 --- a/src/components/Notes/Note.tsx +++ b/src/components/Notes/Note.tsx @@ -43,14 +43,18 @@ export const Note = ({ ndkEvent }: NoteProps) => { filterKey, DEFAULT_FILTER_OPTIONS ) - const isNsfw = ndkEvent - .getMatchingTags('L') - .some((t) => t[1] === 'content-warning') const [repostEvent, setRepostEvent] = useState() const [repostProfile, setRepostProfile] = useState() const noteEvent = repostEvent ?? ndkEvent + const isNsfw = noteEvent + .getMatchingTags('L') + .some((t) => t[1] === 'content-warning') const noteProfile = repostProfile ?? eventProfile - const { commentEvents } = useComments(ndkEvent.pubkey, undefined, ndkEvent.id) + const { commentEvents } = useComments( + noteEvent.pubkey, + undefined, + noteEvent.id + ) const [quoteRepostEvents, setQuoteRepostEvents] = useState([]) const [hasQuoted, setHasQuoted] = useState(false) const [repostEvents, setRepostEvents] = useState([]) @@ -175,7 +179,7 @@ export const Note = ({ ndkEvent }: NoteProps) => { // Cancel if not confirmed if (!confirm) return - const repostNdkEvent = await ndkEvent.repost(false) + const repostNdkEvent = await noteEvent.repost(false) const rawEvent = repostNdkEvent.rawEvent() submit( JSON.stringify({ @@ -238,7 +242,7 @@ export const Note = ({ ndkEvent }: NoteProps) => { @@ -277,7 +281,7 @@ export const Note = ({ ndkEvent }: NoteProps) => { {showQuoteRepostPopup && ( setShowQuoteRepostPopup(false)} /> )} @@ -314,7 +318,7 @@ export const Note = ({ ndkEvent }: NoteProps) => { )} {showRepostPopup && ( setShowRepostPopup(false)} />