From 62f91eddf4afcd88e659714efe751bf703ccff63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sun, 5 Oct 2025 16:24:54 +0200 Subject: [PATCH] Do not display mute button in hashtag dropdown when unauthenticated (#36353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../ui/components/hashtag_menu_controller.tsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/app/javascript/mastodon/features/ui/components/hashtag_menu_controller.tsx b/app/javascript/mastodon/features/ui/components/hashtag_menu_controller.tsx index 6707b246728..6833073813d 100644 --- a/app/javascript/mastodon/features/ui/components/hashtag_menu_controller.tsx +++ b/app/javascript/mastodon/features/ui/components/hashtag_menu_controller.tsx @@ -11,6 +11,8 @@ import type { } from 'react-overlays/esm/usePopper'; import { DropdownMenu } from 'mastodon/components/dropdown_menu'; +import { useIdentity } from 'mastodon/identity_context'; +import type { MenuItem } from 'mastodon/models/dropdown_menu'; import { useAppSelector } from 'mastodon/store'; const messages = defineMessages({ @@ -45,6 +47,7 @@ interface TargetParams { export const HashtagMenuController: React.FC = () => { const intl = useIntl(); + const { signedIn } = useIdentity(); const [open, setOpen] = useState(false); const [{ accountId, hashtag }, setTargetParams] = useState({}); const targetRef = useRef(null); @@ -96,8 +99,8 @@ export const HashtagMenuController: React.FC = () => { targetRef.current = null; }, [setOpen]); - const menu = useMemo( - () => [ + const menu = useMemo(() => { + const arr: MenuItem[] = [ { text: intl.formatMessage(messages.browseHashtag, { hashtag, @@ -111,17 +114,20 @@ export const HashtagMenuController: React.FC = () => { }), to: `/@${account?.acct}/tagged/${hashtag}`, }, - null, - { + ]; + + if (signedIn) { + arr.push(null, { text: intl.formatMessage(messages.muteHashtag, { hashtag, }), href: '/filters', dangerous: true, - }, - ], - [intl, hashtag, account], - ); + }); + } + + return arr; + }, [intl, hashtag, account, signedIn]); if (!open) { return null;