[Chat] Gate group chats for under-18 users (#10548)

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Samuel Newman
2026-06-09 16:31:22 +03:00
committed by GitHub
parent 2cb225dddd
commit 84c4223ff9
16 changed files with 180 additions and 96 deletions
+4
View File
@@ -198,6 +198,7 @@ export function ChatList({
}) {
const t = useTheme()
const {t: l} = useLingui()
const aa = useAgeAssurance()
const scrollElRef: ListRef = useAnimatedRef()
const {isWithinSplitView} = useIsWithinSplitView()
@@ -230,6 +231,7 @@ export function ChatList({
const {refetch: refetchInbox} = useListConvosQuery({
status: 'request',
kind: aa.flags.groupChatDisabled ? 'direct' : 'all',
})
useRefreshOnFocus(refetch)
@@ -449,6 +451,7 @@ export function Header({
}) {
const {t: l} = useLingui()
const {gtMobile} = useBreakpoints()
const aa = useAgeAssurance()
const requireEmailVerification = useRequireEmailVerification()
const leftConvos = useLeftConvos()
const {isWithinSplitView} = useIsWithinSplitView()
@@ -462,6 +465,7 @@ export function Header({
useListConvosQuery({
status: 'request',
readState: 'unread',
kind: aa.flags.groupChatDisabled ? 'direct' : 'all',
})
const inboxAllConvos =
+19 -5
View File
@@ -21,6 +21,7 @@ import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRightIcon} from '#/compon
import * as Layout from '#/components/Layout'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {useAgeAssurance} from '#/ageAssurance'
import {useAnalytics} from '#/analytics'
import {IS_NATIVE} from '#/env'
import {useBackgroundNotificationPreferences} from '../../../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
@@ -46,6 +47,7 @@ export function MessagesSettingsScreenInner({}: Props) {
const t = useTheme()
const {t: l} = useLingui()
const ax = useAnalytics()
const aa = useAgeAssurance()
const {currentAccount} = useSession()
const {data: profile} = useProfileQuery({
did: currentAccount!.did,
@@ -55,6 +57,7 @@ export function MessagesSettingsScreenInner({}: Props) {
const exportCarControl = Dialog.useDialogControl()
const isGroupChatEnabled = ax.features.enabled(ax.features.GroupChatsEnable)
const groupInvitesLocked = aa.flags.groupChatDisabled
const allowMessagesFromOptions: {name: AllowIncoming; label: string}[] = [
{
@@ -192,15 +195,26 @@ export function MessagesSettingsScreenInner({}: Props) {
a.leading_snug,
t.atoms.text_contrast_high,
]}>
<Trans>
You can continue ongoing conversations regardless of which
setting you choose.
</Trans>
{groupInvitesLocked ? (
<Trans>
Group chats are only available to users 18 and over.
</Trans>
) : (
<Trans>
You can continue ongoing conversations regardless of which
setting you choose.
</Trans>
)}
</Text>
<Toggle.Group
disabled={groupInvitesLocked}
label={l`Allow group chat invites from`}
type="radio"
values={[resolveAllowGroupInvites(profile?.associated?.chat)]}
values={[
groupInvitesLocked
? 'none'
: resolveAllowGroupInvites(profile?.associated?.chat),
]}
onChange={onSelectGroupInvitesFrom}>
<View>
{allowGroupInvitesFromOptions.map(option => (
+1 -1
View File
@@ -24,9 +24,9 @@ import {createStaticClick, SimpleInlineLinkText} from '#/components/Link'
import {Loader} from '#/components/Loader'
import {usePreemptivelyCompleteActivePolicyUpdate} from '#/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate'
import * as Toast from '#/components/Toast'
import {MIN_ACCESS_AGE} from '#/ageAssurance/const'
import {
isUnderAge,
MIN_ACCESS_AGE,
useAgeAssuranceRegionConfigWithFallback,
} from '#/ageAssurance/util'
import {useAnalytics} from '#/analytics'