Props switcheroo

This commit is contained in:
Eric Bailey
2024-08-20 17:12:53 -05:00
parent eb6b93f0e9
commit fa28411be5
3 changed files with 17 additions and 10 deletions
+4 -1
View File
@@ -117,7 +117,10 @@ export function TitleAndByline({
<View style={[a.flex_1]}> <View style={[a.flex_1]}>
<Hider.Outer <Hider.Outer
modui={modUi} modui={modUi}
override={creator && currentAccount?.did === creator.did}> isContentVisibleInitialState={
creator && currentAccount?.did === creator.did
}
allowOverride={creator && currentAccount?.did === creator.did}>
<Hider.Mask> <Hider.Mask>
<Text <Text
style={[a.text_md, a.font_bold, a.leading_snug, a.italic]} style={[a.text_md, a.font_bold, a.leading_snug, a.italic]}
+9 -7
View File
@@ -16,8 +16,8 @@ type Context = {
info: ModerationCauseDescription info: ModerationCauseDescription
showInfoDialog: () => void showInfoDialog: () => void
meta: { meta: {
isNoPwi?: boolean isNoPwi: boolean
noOverride?: boolean allowOverride: boolean
} }
} }
@@ -27,16 +27,18 @@ export const useHider = () => React.useContext(Context)
export function Outer({ export function Outer({
modui, modui,
override, isContentVisibleInitialState,
allowOverride,
children, children,
}: React.PropsWithChildren<{ }: React.PropsWithChildren<{
override?: boolean isContentVisibleInitialState?: boolean
allowOverride?: boolean
modui: ModerationUI | undefined modui: ModerationUI | undefined
}>) { }>) {
const control = useModerationDetailsDialogControl() const control = useModerationDetailsDialogControl()
const blur = modui?.blurs[0] const blur = modui?.blurs[0]
const [isContentVisible, setIsContentVisible] = React.useState( const [isContentVisible, setIsContentVisible] = React.useState(
override || !blur, isContentVisibleInitialState || !blur,
) )
const info = useModerationCauseDescription(blur) const info = useModerationCauseDescription(blur)
@@ -48,7 +50,7 @@ export function Outer({
cause.labelDef.identifier === '!no-unauthenticated', cause.labelDef.identifier === '!no-unauthenticated',
), ),
), ),
noOverride: modui?.noOverride, allowOverride: allowOverride || !modui?.noOverride,
} }
const showInfoDialog = () => { const showInfoDialog = () => {
@@ -56,7 +58,7 @@ export function Outer({
} }
const onSetContentVisible = (show: boolean) => { const onSetContentVisible = (show: boolean) => {
if (meta.noOverride) return if (meta.allowOverride) return
setIsContentVisible(show) setIsContentVisible(show)
} }
+4 -2
View File
@@ -142,6 +142,7 @@ function ProfileListScreenLoaded({
const queryClient = useQueryClient() const queryClient = useQueryClient()
const {openComposer} = useComposerControls() const {openComposer} = useComposerControls()
const setMinimalShellMode = useSetMinimalShellMode() const setMinimalShellMode = useSetMinimalShellMode()
const {currentAccount} = useSession()
const {rkey} = route.params const {rkey} = route.params
const feedSectionRef = React.useRef<SectionRef>(null) const feedSectionRef = React.useRef<SectionRef>(null)
const aboutSectionRef = React.useRef<SectionRef>(null) const aboutSectionRef = React.useRef<SectionRef>(null)
@@ -149,6 +150,7 @@ function ProfileListScreenLoaded({
const isCurateList = list.purpose === 'app.bsky.graph.defs#curatelist' const isCurateList = list.purpose === 'app.bsky.graph.defs#curatelist'
const isScreenFocused = useIsFocused() const isScreenFocused = useIsFocused()
const isHidden = list.labels?.findIndex(l => l.val === '!hide') !== -1 const isHidden = list.labels?.findIndex(l => l.val === '!hide') !== -1
const isOwner = currentAccount?.did === list.creator.did
const moderation = React.useMemo(() => { const moderation = React.useMemo(() => {
return moderateUserList(list, moderationOpts) return moderateUserList(list, moderationOpts)
@@ -191,7 +193,7 @@ function ProfileListScreenLoaded({
if (isCurateList) { if (isCurateList) {
return ( return (
<Hider.Outer modui={moderation.ui('contentView')}> <Hider.Outer modui={moderation.ui('contentView')} allowOverride={isOwner}>
<Hider.Mask> <Hider.Mask>
<ListHiddenScreen list={list} preferences={preferences} /> <ListHiddenScreen list={list} preferences={preferences} />
</Hider.Mask> </Hider.Mask>
@@ -241,7 +243,7 @@ function ProfileListScreenLoaded({
) )
} }
return ( return (
<Hider.Outer modui={moderation.ui('contentView')}> <Hider.Outer modui={moderation.ui('contentView')} allowOverride={isOwner}>
<Hider.Mask> <Hider.Mask>
<ListHiddenScreen list={list} preferences={preferences} /> <ListHiddenScreen list={list} preferences={preferences} />
</Hider.Mask> </Hider.Mask>