mirror of
https://github.com/tooot-app/app
synced 2025-01-05 05:59:15 +01:00
Fixed #424
This commit is contained in:
parent
5f53f66004
commit
c75ecefb09
@ -33,7 +33,7 @@ const RelationshipOutgoing = React.memo(
|
|||||||
queryKeyRelationship,
|
queryKeyRelationship,
|
||||||
[res]
|
[res]
|
||||||
)
|
)
|
||||||
if (action === 'follow' || action === 'block') {
|
if (action === 'block') {
|
||||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Following' }]
|
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Following' }]
|
||||||
queryClient.invalidateQueries(queryKey)
|
queryClient.invalidateQueries(queryKey)
|
||||||
}
|
}
|
||||||
|
@ -48,40 +48,18 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
const theParams = params as MutationVarsTimelineUpdateStatusProperty
|
const theParams = params as MutationVarsTimelineUpdateStatusProperty
|
||||||
if (
|
if (
|
||||||
// Un-bookmark from bookmarks page
|
// Un-bookmark from bookmarks page
|
||||||
(queryKey[1].page === 'Bookmarks' &&
|
(queryKey[1].page === 'Bookmarks' && theParams.payload.property === 'bookmarked') ||
|
||||||
theParams.payload.property === 'bookmarked') ||
|
|
||||||
// Un-favourite from favourites page
|
// Un-favourite from favourites page
|
||||||
(queryKey[1].page === 'Favourites' &&
|
(queryKey[1].page === 'Favourites' && theParams.payload.property === 'favourited')
|
||||||
theParams.payload.property === 'favourited') ||
|
|
||||||
// Un-reblog from following page
|
|
||||||
(queryKey[1].page === 'Following' &&
|
|
||||||
theParams.payload.property === 'reblogged' &&
|
|
||||||
theParams.payload.currentValue === true)
|
|
||||||
) {
|
) {
|
||||||
queryClient.invalidateQueries(queryKey)
|
queryClient.invalidateQueries(queryKey)
|
||||||
} else if (
|
|
||||||
theParams.payload.property === 'reblogged' &&
|
|
||||||
queryKey[1].page !== 'Following'
|
|
||||||
) {
|
|
||||||
// When reblogged, update cache of following page
|
|
||||||
const tempQueryKey: QueryKeyTimeline = [
|
|
||||||
'Timeline',
|
|
||||||
{ page: 'Following' }
|
|
||||||
]
|
|
||||||
queryClient.invalidateQueries(tempQueryKey)
|
|
||||||
} else if (theParams.payload.property === 'favourited') {
|
} else if (theParams.payload.property === 'favourited') {
|
||||||
// When favourited, update favourited page
|
// When favourited, update favourited page
|
||||||
const tempQueryKey: QueryKeyTimeline = [
|
const tempQueryKey: QueryKeyTimeline = ['Timeline', { page: 'Favourites' }]
|
||||||
'Timeline',
|
|
||||||
{ page: 'Favourites' }
|
|
||||||
]
|
|
||||||
queryClient.invalidateQueries(tempQueryKey)
|
queryClient.invalidateQueries(tempQueryKey)
|
||||||
} else if (theParams.payload.property === 'bookmarked') {
|
} else if (theParams.payload.property === 'bookmarked') {
|
||||||
// When bookmarked, update bookmark page
|
// When bookmarked, update bookmark page
|
||||||
const tempQueryKey: QueryKeyTimeline = [
|
const tempQueryKey: QueryKeyTimeline = ['Timeline', { page: 'Bookmarks' }]
|
||||||
'Timeline',
|
|
||||||
{ page: 'Bookmarks' }
|
|
||||||
]
|
|
||||||
queryClient.invalidateQueries(tempQueryKey)
|
queryClient.invalidateQueries(tempQueryKey)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -91,9 +69,7 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
theme,
|
theme,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: t('common:message.error.message', {
|
message: t('common:message.error.message', {
|
||||||
function: t(
|
function: t(`shared.actions.${correctParam.payload.property}.function`)
|
||||||
`shared.actions.${correctParam.payload.property}.function`
|
|
||||||
)
|
|
||||||
}),
|
}),
|
||||||
...(err.status &&
|
...(err.status &&
|
||||||
typeof err.status === 'number' &&
|
typeof err.status === 'number' &&
|
||||||
@ -182,11 +158,7 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
const childrenReply = useMemo(
|
const childrenReply = useMemo(
|
||||||
() => (
|
() => (
|
||||||
<>
|
<>
|
||||||
<Icon
|
<Icon name='MessageCircle' color={iconColor} size={StyleConstants.Font.Size.L} />
|
||||||
name='MessageCircle'
|
|
||||||
color={iconColor}
|
|
||||||
size={StyleConstants.Font.Size.L}
|
|
||||||
/>
|
|
||||||
{status.replies_count > 0 ? (
|
{status.replies_count > 0 ? (
|
||||||
<CustomText
|
<CustomText
|
||||||
style={{
|
style={{
|
||||||
@ -209,8 +181,7 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
<Icon
|
<Icon
|
||||||
name='Repeat'
|
name='Repeat'
|
||||||
color={
|
color={
|
||||||
status.visibility === 'direct' ||
|
status.visibility === 'direct' || (status.visibility === 'private' && !ownAccount)
|
||||||
(status.visibility === 'private' && !ownAccount)
|
|
||||||
? colors.disabled
|
? colors.disabled
|
||||||
: color(status.reblogged)
|
: color(status.reblogged)
|
||||||
}
|
}
|
||||||
@ -237,11 +208,7 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
const color = (state: boolean) => (state ? colors.red : colors.secondary)
|
const color = (state: boolean) => (state ? colors.red : colors.secondary)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Icon
|
<Icon name='Heart' color={color(status.favourited)} size={StyleConstants.Font.Size.L} />
|
||||||
name='Heart'
|
|
||||||
color={color(status.favourited)}
|
|
||||||
size={StyleConstants.Font.Size.L}
|
|
||||||
/>
|
|
||||||
{status.favourites_count > 0 ? (
|
{status.favourites_count > 0 ? (
|
||||||
<CustomText
|
<CustomText
|
||||||
style={{
|
style={{
|
||||||
@ -260,29 +227,21 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
const childrenBookmark = useMemo(() => {
|
const childrenBookmark = useMemo(() => {
|
||||||
const color = (state: boolean) => (state ? colors.yellow : colors.secondary)
|
const color = (state: boolean) => (state ? colors.yellow : colors.secondary)
|
||||||
return (
|
return (
|
||||||
<Icon
|
<Icon name='Bookmark' color={color(status.bookmarked)} size={StyleConstants.Font.Size.L} />
|
||||||
name='Bookmark'
|
|
||||||
color={color(status.bookmarked)}
|
|
||||||
size={StyleConstants.Font.Size.L}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
}, [status.bookmarked])
|
}, [status.bookmarked])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
paddingLeft: highlighted
|
paddingLeft: highlighted ? 0 : StyleConstants.Avatar.M + StyleConstants.Spacing.S
|
||||||
? 0
|
|
||||||
: StyleConstants.Avatar.M + StyleConstants.Spacing.S
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={{ flexDirection: 'row' }}>
|
<View style={{ flexDirection: 'row' }}>
|
||||||
<Pressable
|
<Pressable
|
||||||
{...(highlighted
|
{...(highlighted
|
||||||
? {
|
? {
|
||||||
accessibilityLabel: t(
|
accessibilityLabel: t('shared.actions.reply.accessibilityLabel'),
|
||||||
'shared.actions.reply.accessibilityLabel'
|
|
||||||
),
|
|
||||||
accessibilityRole: 'button'
|
accessibilityRole: 'button'
|
||||||
}
|
}
|
||||||
: { accessibilityLabel: '' })}
|
: { accessibilityLabel: '' })}
|
||||||
@ -294,9 +253,7 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
<Pressable
|
<Pressable
|
||||||
{...(highlighted
|
{...(highlighted
|
||||||
? {
|
? {
|
||||||
accessibilityLabel: t(
|
accessibilityLabel: t('shared.actions.reblogged.accessibilityLabel'),
|
||||||
'shared.actions.reblogged.accessibilityLabel'
|
|
||||||
),
|
|
||||||
accessibilityRole: 'button'
|
accessibilityRole: 'button'
|
||||||
}
|
}
|
||||||
: { accessibilityLabel: '' })}
|
: { accessibilityLabel: '' })}
|
||||||
@ -304,17 +261,14 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
onPress={onPressReblog}
|
onPress={onPressReblog}
|
||||||
children={childrenReblog}
|
children={childrenReblog}
|
||||||
disabled={
|
disabled={
|
||||||
status.visibility === 'direct' ||
|
status.visibility === 'direct' || (status.visibility === 'private' && !ownAccount)
|
||||||
(status.visibility === 'private' && !ownAccount)
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Pressable
|
<Pressable
|
||||||
{...(highlighted
|
{...(highlighted
|
||||||
? {
|
? {
|
||||||
accessibilityLabel: t(
|
accessibilityLabel: t('shared.actions.favourited.accessibilityLabel'),
|
||||||
'shared.actions.favourited.accessibilityLabel'
|
|
||||||
),
|
|
||||||
accessibilityRole: 'button'
|
accessibilityRole: 'button'
|
||||||
}
|
}
|
||||||
: { accessibilityLabel: '' })}
|
: { accessibilityLabel: '' })}
|
||||||
@ -326,9 +280,7 @@ const TimelineActions: React.FC<Props> = ({
|
|||||||
<Pressable
|
<Pressable
|
||||||
{...(highlighted
|
{...(highlighted
|
||||||
? {
|
? {
|
||||||
accessibilityLabel: t(
|
accessibilityLabel: t('shared.actions.bookmarked.accessibilityLabel'),
|
||||||
'shared.actions.bookmarked.accessibilityLabel'
|
|
||||||
),
|
|
||||||
accessibilityRole: 'button'
|
accessibilityRole: 'button'
|
||||||
}
|
}
|
||||||
: { accessibilityLabel: '' })}
|
: { accessibilityLabel: '' })}
|
||||||
|
@ -9,7 +9,7 @@ import formatText from '@screens/Compose/formatText'
|
|||||||
import ComposeRoot from '@screens/Compose/Root'
|
import ComposeRoot from '@screens/Compose/Root'
|
||||||
import * as Sentry from '@sentry/react-native'
|
import * as Sentry from '@sentry/react-native'
|
||||||
import { RootStackScreenProps } from '@utils/navigation/navigators'
|
import { RootStackScreenProps } from '@utils/navigation/navigators'
|
||||||
import { QueryKeyTimeline, useTimelineMutation } from '@utils/queryHooks/timeline'
|
import { useTimelineMutation } from '@utils/queryHooks/timeline'
|
||||||
import { updateStoreReview } from '@utils/slices/contextsSlice'
|
import { updateStoreReview } from '@utils/slices/contextsSlice'
|
||||||
import {
|
import {
|
||||||
getInstanceAccount,
|
getInstanceAccount,
|
||||||
@ -280,8 +280,6 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
|
|||||||
} else {
|
} else {
|
||||||
dispatch(updateStoreReview(1))
|
dispatch(updateStoreReview(1))
|
||||||
}
|
}
|
||||||
const queryKey: QueryKeyTimeline = ['Timeline', { page: 'Following' }]
|
|
||||||
queryClient.invalidateQueries(queryKey)
|
|
||||||
|
|
||||||
switch (params?.type) {
|
switch (params?.type) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
|
Loading…
Reference in New Issue
Block a user