feat: hide content mentioning muted users (#524)

Co-authored-by: mleku <me@mleku.dev>
This commit is contained in:
Cody Tseng 2025-09-02 22:18:34 +08:00 committed by GitHub
parent d3578184fb
commit 3c657dfa8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 289 additions and 83 deletions

View file

@ -7,6 +7,9 @@ type TContentPolicyContext = {
defaultShowNsfw: boolean
setDefaultShowNsfw: (showNsfw: boolean) => void
hideContentMentioningMutedUsers?: boolean
setHideContentMentioningMutedUsers?: (hide: boolean) => void
}
const ContentPolicyContext = createContext<TContentPolicyContext | undefined>(undefined)
@ -22,6 +25,9 @@ export const useContentPolicy = () => {
export function ContentPolicyProvider({ children }: { children: React.ReactNode }) {
const [autoplay, setAutoplay] = useState<boolean>(storage.getAutoplay())
const [defaultShowNsfw, setDefaultShowNsfw] = useState<boolean>(storage.getDefaultShowNsfw())
const [hideContentMentioningMutedUsers, setHideContentMentioningMutedUsers] = useState<boolean>(
storage.getHideContentMentioningMutedUsers()
)
const updateAutoplay = (autoplay: boolean) => {
storage.setAutoplay(autoplay)
@ -33,13 +39,20 @@ export function ContentPolicyProvider({ children }: { children: React.ReactNode
setDefaultShowNsfw(defaultShowNsfw)
}
const updateHideContentMentioningMutedUsers = (hide: boolean) => {
storage.setHideContentMentioningMutedUsers(hide)
setHideContentMentioningMutedUsers(hide)
}
return (
<ContentPolicyContext.Provider
value={{
autoplay,
setAutoplay: updateAutoplay,
defaultShowNsfw,
setDefaultShowNsfw: updateDefaultShowNsfw
setDefaultShowNsfw: updateDefaultShowNsfw,
hideContentMentioningMutedUsers,
setHideContentMentioningMutedUsers: updateHideContentMentioningMutedUsers
}}
>
{children}