From e523da0d4321f8301e928afb6f2787e99dab6646 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Tue, 30 Sep 2025 14:10:05 -1000 Subject: [PATCH] don't show comment button in highlight tool if comments disabled --- .../[publication]/[rkey]/QuoteHandler.tsx | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx b/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx index d923ae67..b551dbd7 100644 --- a/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx +++ b/app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx @@ -13,6 +13,7 @@ import { useIdentityData } from "components/IdentityProvider"; import { CommentTiny } from "components/Icons/CommentTiny"; import { setInteractionState } from "./Interactions/Interactions"; import { PostPageContext } from "./PostPageContext"; +import { PubLeafletPublication } from "lexicons/api"; export function QuoteHandler() { let [position, setPosition] = useState<{ @@ -131,7 +132,8 @@ export const QuoteOptionButtons = (props: { position: string }) => { let { identity } = useIdentityData(); const data = useContext(PostPageContext); const document_uri = data?.uri; - if (!document_uri) throw new Error('document_uri not available in PostPageContext'); + if (!document_uri) + throw new Error("document_uri not available in PostPageContext"); let [url, position] = useMemo(() => { let currentUrl = new URL(window.location.href); let pos = decodeQuotePosition(props.position); @@ -139,13 +141,16 @@ export const QuoteOptionButtons = (props: { position: string }) => { currentUrl.pathname = currentUrl.pathname.split("/l-quote/")[0]; } currentUrl.pathname = currentUrl.pathname + `/l-quote/${props.position}`; - + // Clear existing query parameters currentUrl.search = ""; currentUrl.hash = `#${pos?.start.block.join(".")}_${pos?.start.offset}`; return [currentUrl.toString(), pos]; }, [props.position]); + let pubRecord = data.documents_in_publications[0]?.publications?.record as + | PubLeafletPublication.Record + | undefined; return ( <> @@ -183,22 +188,23 @@ export const QuoteOptionButtons = (props: { position: string }) => { Link - - - {identity?.atp_did && ( - + {pubRecord?.preferences?.showComments !== false && identity?.atp_did && ( + <> + + + )} ); -- 2.51.2