This commit is contained in:
xmflsct 2022-11-17 20:13:09 +01:00
parent 94c4c7c942
commit aa5ad5cd4e
1 changed files with 19 additions and 24 deletions

View File

@ -22,13 +22,7 @@ export interface Props {
id: Mastodon.Account['id'] id: Mastodon.Account['id']
} }
const contextMenuAccount = ({ const contextMenuAccount = ({ actions, type, queryKey, rootQueryKey, id: accountId }: Props) => {
actions,
type,
queryKey,
rootQueryKey,
id: accountId
}: Props) => {
const { theme } = useTheme() const { theme } = useTheme()
const { t } = useTranslation('componentContextMenu') const { t } = useTranslation('componentContextMenu')
@ -76,10 +70,7 @@ const contextMenuAccount = ({
} }
}) })
const instanceAccount = useSelector( const instanceAccount = useSelector(getInstanceAccount, (prev, next) => prev.id === next.id)
getInstanceAccount,
(prev, next) => prev.id === next.id
)
const ownAccount = instanceAccount?.id === accountId const ownAccount = instanceAccount?.id === accountId
const { data: relationship } = useRelationshipQuery({ const { data: relationship } = useRelationshipQuery({
@ -88,15 +79,13 @@ const contextMenuAccount = ({
}) })
if (!ownAccount) { if (!ownAccount) {
actions.push( actions.push({
{
id: 'account-mute', id: 'account-mute',
title: t('account.mute.action', { title: t('account.mute.action', {
context: (relationship?.muting || false).toString() context: (relationship?.muting || false).toString()
}), }),
systemIcon: 'eye.slash' systemIcon: 'eye.slash'
} })
)
switch (Platform.OS) { switch (Platform.OS) {
case 'ios': case 'ios':
actions.push({ actions.push({
@ -153,7 +142,10 @@ const contextMenuAccount = ({
payload: { property: 'mute', currentValue: relationship?.muting } payload: { property: 'mute', currentValue: relationship?.muting }
}) })
} }
if (actions[index].id === 'account-block') { if (
actions[index].id === 'account-block' ||
(actions[index].id === 'account' && actions[index].actions?.[0].id === 'account-block')
) {
analytics('timeline_shared_headeractions_account_block_press', { analytics('timeline_shared_headeractions_account_block_press', {
page: queryKey && queryKey[1].page page: queryKey && queryKey[1].page
}) })
@ -164,7 +156,10 @@ const contextMenuAccount = ({
payload: { property: 'block', currentValue: relationship?.blocking } payload: { property: 'block', currentValue: relationship?.blocking }
}) })
} }
if (actions[index].id === 'account-reports') { if (
actions[index].id === 'account-reports' ||
(actions[index].id === 'account' && actions[index].actions?.[0].id === 'account-reports')
) {
analytics('timeline_shared_headeractions_account_reports_press', { analytics('timeline_shared_headeractions_account_reports_press', {
page: queryKey && queryKey[1].page page: queryKey && queryKey[1].page
}) })