mirror of https://github.com/tooot-app/app
Fixed #439
This commit is contained in:
parent
28028c8aab
commit
d4be002016
|
@ -884,7 +884,7 @@ SPEC CHECKSUMS:
|
|||
FirebaseCoreInternal: bca76517fe1ed381e989f5e7d8abb0da8d85bed3
|
||||
FirebaseInstallations: 0a115432c4e223c5ab20b0dbbe4cbefa793a0e8e
|
||||
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
|
||||
glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a
|
||||
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
|
||||
GoogleAppMeasurement: 6ee231473fbd75c11221dfce489894334024eead
|
||||
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
|
||||
GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7
|
||||
|
|
|
@ -29,6 +29,7 @@ declare namespace Mastodon {
|
|||
fields: Field[]
|
||||
bot: boolean
|
||||
source?: Source
|
||||
suspended?: boolean
|
||||
}
|
||||
|
||||
type Announcement = {
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
[
|
||||
{
|
||||
"feature": "account_return_suspended",
|
||||
"version": 3.3,
|
||||
"reference": "https://github.com/mastodon/mastodon/releases/tag/v3.3.0"
|
||||
},
|
||||
{
|
||||
"feature": "edit_post",
|
||||
"version": 3.5,
|
||||
|
@ -9,11 +14,6 @@
|
|||
"version": 3.5,
|
||||
"reference": "https://github.com/mastodon/mastodon/releases/tag/v3.5.0"
|
||||
},
|
||||
{
|
||||
"feature": "notification_type_status",
|
||||
"version": 3.3,
|
||||
"reference": "https://docs.joinmastodon.org/entities/notification/#required-attributes"
|
||||
},
|
||||
{
|
||||
"feature": "notification_type_update",
|
||||
"version": 3.5,
|
||||
|
|
|
@ -304,7 +304,8 @@
|
|||
"toots": {
|
||||
"default": "Toots",
|
||||
"all": "Toots and replies"
|
||||
}
|
||||
},
|
||||
"suspended": "Account suspended by the moderators of your server"
|
||||
},
|
||||
"attachments": {
|
||||
"name": "<0 /><1>\"s media</1>"
|
||||
|
|
|
@ -6,9 +6,9 @@ import { useAccountQuery } from '@utils/queryHooks/account'
|
|||
import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { useTheme } from '@utils/styles/ThemeManager'
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
import { StyleSheet, Text, View } from 'react-native'
|
||||
import { useSharedValue } from 'react-native-reanimated'
|
||||
import { useIsFetching } from 'react-query'
|
||||
import AccountAttachments from './Account/Attachments'
|
||||
|
@ -16,9 +16,7 @@ import AccountHeader from './Account/Header'
|
|||
import AccountInformation from './Account/Information'
|
||||
import AccountNav from './Account/Nav'
|
||||
|
||||
const TabSharedAccount: React.FC<
|
||||
TabSharedStackScreenProps<'Tab-Shared-Account'>
|
||||
> = ({
|
||||
const TabSharedAccount: React.FC<TabSharedStackScreenProps<'Tab-Shared-Account'>> = ({
|
||||
route: {
|
||||
params: { account }
|
||||
}
|
||||
|
@ -48,35 +46,42 @@ const TabSharedAccount: React.FC<
|
|||
<View style={[styles.header, { borderBottomColor: colors.border }]}>
|
||||
<AccountHeader account={data} />
|
||||
<AccountInformation account={data} />
|
||||
{fetchedTimeline.current ? (
|
||||
{!data?.suspended && fetchedTimeline.current ? (
|
||||
<AccountAttachments account={data} />
|
||||
) : null}
|
||||
</View>
|
||||
<SegmentedControl
|
||||
appearance={mode}
|
||||
values={[
|
||||
t('shared.account.toots.default'),
|
||||
t('shared.account.toots.all')
|
||||
]}
|
||||
selectedIndex={queryKey[1].page === 'Account_Default' ? 0 : 1}
|
||||
onChange={({ nativeEvent }) => {
|
||||
switch (nativeEvent.selectedSegmentIndex) {
|
||||
case 0:
|
||||
setQueryKey([
|
||||
queryKey[0],
|
||||
{ ...queryKey[1], page: 'Account_Default' }
|
||||
])
|
||||
break
|
||||
case 1:
|
||||
setQueryKey([
|
||||
queryKey[0],
|
||||
{ ...queryKey[1], page: 'Account_All' }
|
||||
])
|
||||
break
|
||||
}
|
||||
}}
|
||||
style={styles.segmentsContainer}
|
||||
/>
|
||||
{!data?.suspended ? (
|
||||
<SegmentedControl
|
||||
appearance={mode}
|
||||
values={[t('shared.account.toots.default'), t('shared.account.toots.all')]}
|
||||
selectedIndex={queryKey[1].page === 'Account_Default' ? 0 : 1}
|
||||
onChange={({ nativeEvent }) => {
|
||||
switch (nativeEvent.selectedSegmentIndex) {
|
||||
case 0:
|
||||
setQueryKey([queryKey[0], { ...queryKey[1], page: 'Account_Default' }])
|
||||
break
|
||||
case 1:
|
||||
setQueryKey([queryKey[0], { ...queryKey[1], page: 'Account_All' }])
|
||||
break
|
||||
}
|
||||
}}
|
||||
style={styles.segmentsContainer}
|
||||
/>
|
||||
) : null}
|
||||
{data?.suspended ? (
|
||||
<View
|
||||
style={{
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
paddingHorizontal: StyleConstants.Spacing.Global.PagePadding
|
||||
}}
|
||||
>
|
||||
<Text style={{ ...StyleConstants.FontStyle.M, color: colors.secondary, textAlign: 'center' }}>
|
||||
{t('shared.account.suspended')}
|
||||
</Text>
|
||||
</View>
|
||||
) : null}
|
||||
</>
|
||||
)
|
||||
}, [data, fetchedTimeline.current, queryKey[1].page, i18n.language, mode])
|
||||
|
@ -85,19 +90,20 @@ const TabSharedAccount: React.FC<
|
|||
<>
|
||||
<AccountNav scrollY={scrollY} account={data} />
|
||||
|
||||
<Timeline
|
||||
queryKey={queryKey}
|
||||
disableRefresh
|
||||
customProps={{
|
||||
renderItem: ({ item }) => (
|
||||
<TimelineDefault item={item} queryKey={queryKey} />
|
||||
),
|
||||
onScroll: ({ nativeEvent }) =>
|
||||
(scrollY.value = nativeEvent.contentOffset.y),
|
||||
ListHeaderComponent,
|
||||
maintainVisibleContentPosition: undefined
|
||||
}}
|
||||
/>
|
||||
{data?.suspended ? (
|
||||
ListHeaderComponent
|
||||
) : (
|
||||
<Timeline
|
||||
queryKey={queryKey}
|
||||
disableRefresh
|
||||
customProps={{
|
||||
renderItem: ({ item }) => <TimelineDefault item={item} queryKey={queryKey} />,
|
||||
onScroll: ({ nativeEvent }) => (scrollY.value = nativeEvent.contentOffset.y),
|
||||
ListHeaderComponent,
|
||||
maintainVisibleContentPosition: undefined
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ const AccountInformationAccount: React.FC<Props> = ({
|
|||
) : null}
|
||||
<CustomText
|
||||
style={{
|
||||
textDecorationLine: account?.moved ? 'line-through' : undefined
|
||||
textDecorationLine: (account?.moved || account?.suspended) ? 'line-through' : undefined
|
||||
}}
|
||||
selectable
|
||||
>
|
||||
|
|
|
@ -37,7 +37,7 @@ const Conversation = ({ account }: { account: Mastodon.Account }) => {
|
|||
}
|
||||
|
||||
const AccountInformationActions: React.FC<Props> = ({ account, myInfo }) => {
|
||||
if (!account) {
|
||||
if (!account || account.suspended) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ export interface Props {
|
|||
|
||||
const AccountInformationFields = React.memo(
|
||||
({ account, myInfo }: Props) => {
|
||||
if (myInfo || !account?.fields || account.fields.length === 0) {
|
||||
if (account?.suspended || myInfo || !account?.fields || account.fields.length === 0) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,8 @@ const AccountInformationFields = React.memo(
|
|||
return (
|
||||
<View style={[styles.fields, { borderTopColor: colors.border }]}>
|
||||
{account.fields.map((field, index) => (
|
||||
<View
|
||||
key={index}
|
||||
style={[styles.field, { borderBottomColor: colors.border }]}
|
||||
>
|
||||
<View
|
||||
style={[styles.fieldLeft, { borderRightColor: colors.border }]}
|
||||
>
|
||||
<View key={index} style={[styles.field, { borderBottomColor: colors.border }]}>
|
||||
<View style={[styles.fieldLeft, { borderRightColor: colors.border }]}>
|
||||
<ParseHTML
|
||||
content={field.name}
|
||||
size={'S'}
|
||||
|
|
|
@ -41,7 +41,7 @@ const AccountInformationName: React.FC<Props> = ({ account }) => {
|
|||
<>
|
||||
<CustomText
|
||||
style={{
|
||||
textDecorationLine: account?.moved ? 'line-through' : undefined
|
||||
textDecorationLine: account?.moved || account.suspended ? 'line-through' : undefined
|
||||
}}
|
||||
>
|
||||
<ParseEmojis
|
||||
|
|
|
@ -12,6 +12,7 @@ const AccountInformationNote = React.memo(
|
|||
({ account, myInfo }: Props) => {
|
||||
const [note, setNote] = useState(account?.source?.note)
|
||||
if (
|
||||
account?.suspended ||
|
||||
myInfo ||
|
||||
!account?.note ||
|
||||
account.note.length === 0 ||
|
||||
|
|
|
@ -16,8 +16,11 @@ export interface Props {
|
|||
}
|
||||
|
||||
const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
|
||||
const navigation =
|
||||
useNavigation<StackNavigationProp<TabLocalStackParamList>>()
|
||||
if (account?.suspended) {
|
||||
return null
|
||||
}
|
||||
|
||||
const navigation = useNavigation<StackNavigationProp<TabLocalStackParamList>>()
|
||||
const { colors } = useTheme()
|
||||
const { t } = useTranslation('screenTabs')
|
||||
|
||||
|
@ -31,9 +34,7 @@ const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
|
|||
})}
|
||||
onPress={() => {
|
||||
analytics('account_stats_toots_press')
|
||||
myInfo &&
|
||||
account &&
|
||||
navigation.push('Tab-Shared-Account', { account })
|
||||
myInfo && account && navigation.push('Tab-Shared-Account', { account })
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
|
@ -47,10 +48,7 @@ const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
|
|||
)}
|
||||
{account ? (
|
||||
<CustomText
|
||||
style={[
|
||||
styles.stat,
|
||||
{ color: colors.primaryDefault, textAlign: 'right' }
|
||||
]}
|
||||
style={[styles.stat, { color: colors.primaryDefault, textAlign: 'right' }]}
|
||||
children={t('shared.account.summary.following_count', {
|
||||
count: account.following_count
|
||||
})}
|
||||
|
@ -77,10 +75,7 @@ const AccountInformationStats: React.FC<Props> = ({ account, myInfo }) => {
|
|||
)}
|
||||
{account ? (
|
||||
<CustomText
|
||||
style={[
|
||||
styles.stat,
|
||||
{ color: colors.primaryDefault, textAlign: 'center' }
|
||||
]}
|
||||
style={[styles.stat, { color: colors.primaryDefault, textAlign: 'center' }]}
|
||||
children={t('shared.account.summary.followers_count', {
|
||||
count: account.followers_count
|
||||
})}
|
||||
|
|
Loading…
Reference in New Issue