From 8cab77415edadfa6e84b1e3c532bcc790f4a58bb Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 4 Mar 2024 09:56:38 +0800 Subject: [PATCH] Only show share and embed if public or unlisted Also slight refactor --- src/components/status.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/status.jsx b/src/components/status.jsx index 49ed783d..607951cc 100644 --- a/src/components/status.jsx +++ b/src/components/status.jsx @@ -711,6 +711,8 @@ function Status({ } const actionsRef = useRef(); + const isPublic = ['public', 'unlisted'].includes(visibility); + const isPinnable = ['public', 'unlisted', 'private'].includes(visibility); const StatusMenuItems = ( <> {isSizeLarge && ( @@ -916,7 +918,8 @@ function Status({ Copy - {navigator?.share && + {isPublic && + navigator?.share && navigator?.canShare?.({ url, }) && ( @@ -937,7 +940,7 @@ function Status({ )} - {isSizeLarge && ( + {isPublic && isSizeLarge && ( { setShowEmbed(true); @@ -980,7 +983,7 @@ function Status({ )} )} - {isSelf && /(public|unlisted|private)/i.test(visibility) && ( + {isSelf && isPinnable && ( { try {