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

@ -11,7 +11,7 @@ import Icon from './Icon'
import CustomText from './Text'
export interface Props {
account: Partial<Mastodon.Account> & Pick<Mastodon.Account, 'id' | 'acct' | 'username'>
account: Partial<Mastodon.Account> & Pick<Mastodon.Account, 'id' | 'acct' | 'username' | 'url'>
props?: PressableProps
}

View File

@ -168,10 +168,7 @@ const ParseHTML: React.FC<Props> = ({
matchedMention &&
!disableDetails &&
!sameAccount &&
navigation.push('Tab-Shared-Account', {
account: matchedMention,
isRemote: status?._remote
})
navigation.push('Tab-Shared-Account', { account: matchedMention })
}
children={node.children.map(unwrapNode).join('')}
/>

View File

@ -37,7 +37,6 @@ export interface Props {
disableDetails?: boolean
disableOnPress?: boolean
isConversation?: boolean
isRemote?: boolean
}
// When the poll is long
@ -48,8 +47,7 @@ const TimelineDefault: React.FC<Props> = ({
highlighted = false,
disableDetails = false,
disableOnPress = false,
isConversation = false,
isRemote = false
isConversation = false
}) => {
const status = item.reblog ? item.reblog : item
const rawContent = useRef<string[]>([])
@ -177,7 +175,7 @@ const TimelineDefault: React.FC<Props> = ({
disableDetails,
disableOnPress,
isConversation,
isRemote
isRemote: item._remote
}}
>
{disableOnPress ? (

View File

@ -38,7 +38,7 @@ const TimelineActioned: React.FC<Props> = ({ action, isNotification, ...rest })
)
const onPress = () =>
navigation.push('Tab-Shared-Account', { account, isRemote: status?._remote })
navigation.push('Tab-Shared-Account', { account })
const children = () => {
switch (action) {

View File

@ -114,7 +114,8 @@ const TimelineActions: React.FC = () => {
status,
payload: {
type: 'reblogged',
visibility: 'public'
visibility: 'public',
to: true
}
})
break
@ -126,7 +127,8 @@ const TimelineActions: React.FC = () => {
status,
payload: {
type: 'reblogged',
visibility: 'unlisted'
visibility: 'unlisted',
to: true
}
})
break
@ -141,7 +143,8 @@ const TimelineActions: React.FC = () => {
status,
payload: {
type: 'reblogged',
visibility: 'public'
visibility: 'public',
to: false
}
})
}
@ -153,7 +156,8 @@ const TimelineActions: React.FC = () => {
rootQueryKey,
status,
payload: {
type: 'favourited'
type: 'favourited',
to: !status.favourited
}
})
}
@ -164,7 +168,8 @@ const TimelineActions: React.FC = () => {
rootQueryKey,
status,
payload: {
type: 'bookmarked'
type: 'bookmarked',
to: !status.bookmarked
}
})
}

View File

@ -32,7 +32,7 @@ const TimelineAvatar: React.FC<Props> = ({ account }) => {
})}
onPress={() =>
!disableOnPress &&
navigation.push('Tab-Shared-Account', { account: actualAccount, isRemote: status?._remote })
navigation.push('Tab-Shared-Account', { account: actualAccount })
}
uri={{ original: actualAccount.avatar, static: actualAccount.avatar_static }}
dimension={

View File

@ -86,7 +86,8 @@ const TimelineCard: React.FC = () => {
}, [])
const accountQuery = useAccountQuery({
id: isAccount?.style === 'default' ? isAccount.id : '',
account:
isAccount?.style === 'default' ? { id: isAccount.id, url: status.card.url } : undefined,
options: { enabled: false }
})
useEffect(() => {

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',