feat: hide replies from untrusted users

This commit is contained in:
codytseng
2025-06-01 22:00:57 +08:00
parent 4785efd43c
commit 1bd8ee03b1
8 changed files with 159 additions and 24 deletions

View File

@@ -6,6 +6,7 @@ import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { cn } from '@/lib/utils'
import { useAutoplay } from '@/providers/AutoplayProvider'
import { useTheme } from '@/providers/ThemeProvider'
import { useUserTrust } from '@/providers/UserTrustProvider'
import { SelectValue } from '@radix-ui/react-select'
import { forwardRef, HTMLProps, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -15,6 +16,8 @@ const GeneralSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
const [language, setLanguage] = useState<TLanguage>(i18n.language as TLanguage)
const { themeSetting, setThemeSetting } = useTheme()
const { autoplay, setAutoplay } = useAutoplay()
const { enabled: hideUntrustedRepliesEnabled, updateEnabled: updateHideUntrustedRepliesEnabled } =
useUserTrust()
const handleLanguageChange = (value: TLanguage) => {
i18n.changeLanguage(value)
@@ -63,6 +66,19 @@ const GeneralSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
</Label>
<Switch id="autoplay" checked={autoplay} onCheckedChange={setAutoplay} />
</SettingItem>
<SettingItem>
<Label htmlFor="hide-untrusted-replies" className="text-base font-normal">
{t('Hide replies from untrusted users')}
<div className="text-muted-foreground">
{t('Only show replies from your followed users and the users they follow')}
</div>
</Label>
<Switch
id="hide-untrusted-replies"
checked={hideUntrustedRepliesEnabled}
onCheckedChange={updateHideUntrustedRepliesEnabled}
/>
</SettingItem>
</div>
</SecondaryPageLayout>
)