Fix proper reblog permission

https://github.com/tooot-app/app/issues/274
This commit is contained in:
Zhiyuan Zheng 2022-05-16 21:54:11 +02:00
parent 00b0ad3ac5
commit d0aa55d021
6 changed files with 20 additions and 12 deletions

View File

@ -4,7 +4,7 @@
"native": "220508",
"major": 4,
"minor": 0,
"patch": 0,
"patch": 1,
"expo": "45.0.0"
},
"description": "tooot app for Mastodon",

View File

@ -54,7 +54,6 @@ import { enableFreeze } from 'react-native-screens'
import { QueryClientProvider } from 'react-query'
import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react'
import { IntlProvider } from 'react-intl'
Platform.select({
android: LogBox.ignoreLogs(['Setting a timer for a long period of time'])
@ -132,9 +131,7 @@ const App: React.FC = () => {
<ActionSheetProvider>
<AccessibilityManager>
<ThemeManager>
<IntlProvider locale={language}>
<Screens localCorrupt={localCorrupt} />
</IntlProvider>
<Screens localCorrupt={localCorrupt} />
</ThemeManager>
</AccessibilityManager>
</ActionSheetProvider>

View File

@ -26,6 +26,7 @@ import * as Linking from 'expo-linking'
import { addScreenshotListener } from 'expo-screen-capture'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { IntlProvider } from 'react-intl'
import { Alert, Platform, StatusBar } from 'react-native'
import ShareMenu from 'react-native-share-menu'
import { useSelector } from 'react-redux'
@ -39,7 +40,7 @@ export interface Props {
}
const Screens: React.FC<Props> = ({ localCorrupt }) => {
const { t } = useTranslation('screens')
const { i18n, t } = useTranslation('screens')
const dispatch = useAppDispatch()
const instanceActive = useSelector(getInstanceActive)
const { colors, theme } = useTheme()
@ -320,7 +321,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
}, [])
return (
<>
<IntlProvider locale={i18n.language}>
<StatusBar backgroundColor={colors.backgroundDefault} />
<NavigationContainer
ref={navigationRef}
@ -381,7 +382,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
<Message />
</NavigationContainer>
</>
</IntlProvider>
)
}

View File

@ -156,6 +156,7 @@ const TimelineDefault = React.memo(
rootQueryKey={rootQueryKey}
highlighted={highlighted}
status={actualStatus}
ownAccount={ownAccount}
accts={uniqBy(
(
[actualStatus.account] as Mastodon.Account[] &

View File

@ -22,6 +22,7 @@ export interface Props {
rootQueryKey?: QueryKeyTimeline
highlighted: boolean
status: Mastodon.Status
ownAccount?: boolean
accts: Mastodon.Account['acct'][] // When replying to conversations
reblog: boolean
}
@ -31,6 +32,7 @@ const TimelineActions: React.FC<Props> = ({
rootQueryKey,
highlighted,
status,
ownAccount = false,
accts,
reblog
}) => {
@ -207,7 +209,8 @@ const TimelineActions: React.FC<Props> = ({
<Icon
name='Repeat'
color={
status.visibility === 'direct'
status.visibility === 'direct' ||
(status.visibility === 'private' && !ownAccount)
? colors.disabled
: color(status.reblogged)
}
@ -216,7 +219,10 @@ const TimelineActions: React.FC<Props> = ({
{status.reblogs_count > 0 ? (
<CustomText
style={{
color: color(status.reblogged),
color:
status.visibility === 'private' && !ownAccount
? colors.disabled
: color(status.reblogged),
fontSize: StyleConstants.Font.Size.M,
marginLeft: StyleConstants.Spacing.XS
}}
@ -297,7 +303,10 @@ const TimelineActions: React.FC<Props> = ({
style={styles.action}
onPress={onPressReblog}
children={childrenReblog}
disabled={status.visibility === 'direct'}
disabled={
status.visibility === 'direct' ||
(status.visibility === 'private' && !ownAccount)
}
/>
<Pressable

View File

@ -4,7 +4,7 @@ import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { FormattedDate, FormattedRelativeTime, FormattedTime } from 'react-intl'
import { FormattedDate, FormattedRelativeTime } from 'react-intl'
export interface Props {
created_at: Mastodon.Status['created_at'] | number