Fix "under 18" admonition being incorrectly shown on Moderation screen (#10521)
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -41,6 +41,7 @@ const AgeAssuranceStateContext = createContext<{
|
|||||||
flags: {
|
flags: {
|
||||||
adultContentDisabled: boolean
|
adultContentDisabled: boolean
|
||||||
chatDisabled: boolean
|
chatDisabled: boolean
|
||||||
|
isDeclaredUnderAdultAge: boolean
|
||||||
isOverRegionMinAccessAge: boolean
|
isOverRegionMinAccessAge: boolean
|
||||||
isOverAppMinAccessAge: boolean
|
isOverAppMinAccessAge: boolean
|
||||||
}
|
}
|
||||||
@@ -55,6 +56,7 @@ const AgeAssuranceStateContext = createContext<{
|
|||||||
flags: {
|
flags: {
|
||||||
adultContentDisabled: false,
|
adultContentDisabled: false,
|
||||||
chatDisabled: false,
|
chatDisabled: false,
|
||||||
|
isDeclaredUnderAdultAge: false,
|
||||||
isOverRegionMinAccessAge: false,
|
isOverRegionMinAccessAge: false,
|
||||||
isOverAppMinAccessAge: false,
|
isOverAppMinAccessAge: false,
|
||||||
},
|
},
|
||||||
@@ -106,7 +108,7 @@ function InnerProvider({children}: {children: React.ReactNode}) {
|
|||||||
<AgeAssuranceStateContext.Provider
|
<AgeAssuranceStateContext.Provider
|
||||||
value={useMemo(() => {
|
value={useMemo(() => {
|
||||||
const chatDisabled = state.access !== AgeAssuranceAccess.Full
|
const chatDisabled = state.access !== AgeAssuranceAccess.Full
|
||||||
const isUnderAdultAge = data?.birthdate
|
const isDeclaredUnderAdultAge = data?.birthdate
|
||||||
? isUnderAge(data.birthdate, 18)
|
? isUnderAge(data.birthdate, 18)
|
||||||
: true
|
: true
|
||||||
const isOverRegionMinAccessAge = data?.birthdate
|
const isOverRegionMinAccessAge = data?.birthdate
|
||||||
@@ -116,7 +118,7 @@ function InnerProvider({children}: {children: React.ReactNode}) {
|
|||||||
? !isUnderAge(data.birthdate, MIN_ACCESS_AGE)
|
? !isUnderAge(data.birthdate, MIN_ACCESS_AGE)
|
||||||
: false
|
: false
|
||||||
const adultContentDisabled =
|
const adultContentDisabled =
|
||||||
state.access !== AgeAssuranceAccess.Full || isUnderAdultAge
|
state.access !== AgeAssuranceAccess.Full || isDeclaredUnderAdultAge
|
||||||
return {
|
return {
|
||||||
Access: AgeAssuranceAccess,
|
Access: AgeAssuranceAccess,
|
||||||
Status: AgeAssuranceStatus,
|
Status: AgeAssuranceStatus,
|
||||||
@@ -124,6 +126,7 @@ function InnerProvider({children}: {children: React.ReactNode}) {
|
|||||||
flags: {
|
flags: {
|
||||||
adultContentDisabled,
|
adultContentDisabled,
|
||||||
chatDisabled,
|
chatDisabled,
|
||||||
|
isDeclaredUnderAdultAge,
|
||||||
isOverRegionMinAccessAge,
|
isOverRegionMinAccessAge,
|
||||||
isOverAppMinAccessAge,
|
isOverAppMinAccessAge,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ export function ModerationScreenInner({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.pt_2xl, a.px_lg, gtMobile && a.px_2xl]}>
|
<View style={[a.pt_2xl, a.px_lg, gtMobile && a.px_2xl]}>
|
||||||
{aa.flags.adultContentDisabled && isBirthdateUpdateAllowed && (
|
{aa.flags.isDeclaredUnderAdultAge && isBirthdateUpdateAllowed && (
|
||||||
<View style={[a.pb_2xl]}>
|
<View style={[a.pb_2xl]}>
|
||||||
<Admonition.Admonition type="tip" style={[a.pb_md]}>
|
<Admonition.Admonition type="tip" style={[a.pb_md]}>
|
||||||
<Trans>
|
<Trans>
|
||||||
|
|||||||
Reference in New Issue
Block a user