1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Fix toot action for #638

This commit is contained in:
xmflsct
2023-01-02 23:18:22 +01:00
parent 6dafbc96af
commit 4c6b8f0959
25 changed files with 298 additions and 71 deletions

View File

@ -30,7 +30,7 @@ const menuAccount = ({
}: {
type: 'status' | 'account' // Where the action is coming from
openChange: boolean
account?: Partial<Mastodon.Account> & Pick<Mastodon.Account, 'id' | 'username' | 'acct'>
account?: Partial<Mastodon.Account> & Pick<Mastodon.Account, 'id' | 'username' | 'acct' | 'url'>
status?: Mastodon.Status
queryKey?: QueryKeyTimeline
rootQueryKey?: QueryKeyTimeline
@ -47,10 +47,7 @@ const menuAccount = ({
setEnabled(true)
}
}, [openChange, enabled])
const { data: fetchedAccount } = useAccountQuery({
remoteUrl: account?.url,
options: { enabled: !!status?._remote && enabled }
})
const { data: fetchedAccount } = useAccountQuery({ account, options: { enabled } })
const actualAccount = status?._remote ? fetchedAccount : account
const { data, isFetched } = useRelationshipQuery({
id: actualAccount?.id,

View File

@ -197,7 +197,8 @@ const menuStatus = ({
rootQueryKey,
status,
payload: {
type: 'muted'
type: 'muted',
to: !status.muted
}
}),
disabled: false,
@ -221,7 +222,8 @@ const menuStatus = ({
rootQueryKey,
status,
payload: {
type: 'pinned'
type: 'pinned',
to: !status.pinned
}
}),
disabled: status.visibility !== 'public' && status.visibility !== 'unlisted',