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:
surfdude29
2026-05-26 16:51:48 +01:00
committed by GitHub
parent 68431182ef
commit dc62ce2fb0
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -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,
}, },
+1 -1
View File
@@ -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>