diff --git a/app/javascript/flavours/glitch/features/hashtag_timeline/components/hashtag_header.jsx b/app/javascript/flavours/glitch/features/hashtag_timeline/components/hashtag_header.jsx index 47854d72be6c86..96dda2531856e7 100644 --- a/app/javascript/flavours/glitch/features/hashtag_timeline/components/hashtag_header.jsx +++ b/app/javascript/flavours/glitch/features/hashtag_timeline/components/hashtag_header.jsx @@ -4,12 +4,17 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl'; import ImmutablePropTypes from 'react-immutable-proptypes'; +import MoreHorizIcon from '@/material-icons/400-24px/more_horiz.svg?react'; import { Button } from 'flavours/glitch/components/button'; import { ShortNumber } from 'flavours/glitch/components/short_number'; +import DropdownMenuContainer from 'flavours/glitch/containers/dropdown_menu_container'; +import { withIdentity } from 'flavours/glitch/identity_context'; +import { PERMISSION_MANAGE_TAXONOMIES } from 'flavours/glitch/permissions'; const messages = defineMessages({ followHashtag: { id: 'hashtag.follow', defaultMessage: 'Follow hashtag' }, unfollowHashtag: { id: 'hashtag.unfollow', defaultMessage: 'Unfollow hashtag' }, + adminModeration: { id: 'hashtag.admin_moderation', defaultMessage: 'Open moderation interface for #{name}' }, }); const usesRenderer = (displayNumber, pluralReady) => ( @@ -45,11 +50,18 @@ const usesTodayRenderer = (displayNumber, pluralReady) => ( /> ); -export const HashtagHeader = injectIntl(({ tag, intl, disabled, onClick }) => { +export const HashtagHeader = withIdentity(injectIntl(({ tag, intl, disabled, onClick, identity }) => { if (!tag) { return null; } + const { signedIn, permissions } = identity; + const menu = []; + + if (signedIn && (permissions & PERMISSION_MANAGE_TAXONOMIES) === PERMISSION_MANAGE_TAXONOMIES ) { + menu.push({ text: intl.formatMessage(messages.adminModeration, { name: tag.get("name") }), href: `/admin/tags/${tag.get('id')}` }); + } + const [uses, people] = tag.get('history').reduce((arr, day) => [arr[0] + day.get('uses') * 1, arr[1] + day.get('accounts') * 1], [0, 0]); const dividingCircle = {' ยท '}; @@ -57,7 +69,10 @@ export const HashtagHeader = injectIntl(({ tag, intl, disabled, onClick }) => {