From 2d8c41b411cd063cb22e8298e92e61c17aee66db Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 20 Dec 2024 14:22:16 +0000 Subject: [PATCH 1/2] moderate composer quote --- src/view/com/util/post-embeds/QuoteEmbed.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/view/com/util/post-embeds/QuoteEmbed.tsx b/src/view/com/util/post-embeds/QuoteEmbed.tsx index 77f5f6c951..6fc477cb5c 100644 --- a/src/view/com/util/post-embeds/QuoteEmbed.tsx +++ b/src/view/com/util/post-embeds/QuoteEmbed.tsx @@ -26,7 +26,7 @@ import {useQueryClient} from '@tanstack/react-query' import {HITSLOP_20} from '#/lib/constants' import {usePalette} from '#/lib/hooks/usePalette' import {InfoCircleIcon} from '#/lib/icons' -import {moderatePost_wrapped} from '#/lib/moderatePost_wrapped' +import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' import {makeProfileLink} from '#/lib/routes/links' import {s} from '#/lib/styles' import {useModerationOpts} from '#/state/preferences/moderation-opts' @@ -134,9 +134,7 @@ function QuoteEmbedModerated({ [viewRecord], ) const moderation = React.useMemo(() => { - return moderationOpts - ? moderatePost_wrapped(postView, moderationOpts) - : undefined + return moderationOpts ? moderatePost(postView, moderationOpts) : undefined }, [postView, moderationOpts]) return ( @@ -295,10 +293,17 @@ export function QuoteX({onRemove}: {onRemove: () => void}) { export function LazyQuoteEmbed({uri}: {uri: string}) { const {data} = useResolveLinkQuery(uri) - if (!data || data.type !== 'record' || data.kind !== 'post') { + const moderationOpts = useModerationOpts() + if ( + !data || + data.type !== 'record' || + data.kind !== 'post' || + !moderationOpts + ) { return null } - return + const moderation = moderatePost(data.view, moderationOpts) + return } function viewRecordToPostView( From d8bc780c6c39a54e13643a14b52d08ca47eab55d Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Fri, 20 Dec 2024 15:51:49 +0000 Subject: [PATCH 2/2] consistency with other uses --- src/view/com/util/post-embeds/QuoteEmbed.tsx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/view/com/util/post-embeds/QuoteEmbed.tsx b/src/view/com/util/post-embeds/QuoteEmbed.tsx index 6fc477cb5c..cb549f7cda 100644 --- a/src/view/com/util/post-embeds/QuoteEmbed.tsx +++ b/src/view/com/util/post-embeds/QuoteEmbed.tsx @@ -294,15 +294,12 @@ export function QuoteX({onRemove}: {onRemove: () => void}) { export function LazyQuoteEmbed({uri}: {uri: string}) { const {data} = useResolveLinkQuery(uri) const moderationOpts = useModerationOpts() - if ( - !data || - data.type !== 'record' || - data.kind !== 'post' || - !moderationOpts - ) { + if (!data || data.type !== 'record' || data.kind !== 'post') { return null } - const moderation = moderatePost(data.view, moderationOpts) + const moderation = moderationOpts + ? moderatePost(data.view, moderationOpts) + : undefined return }