feat: hide content mentioning muted users (#524)
Co-authored-by: mleku <me@mleku.dev>
This commit is contained in:
parent
d3578184fb
commit
3c657dfa8c
37 changed files with 289 additions and 83 deletions
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue