[Chat] Gate group chats for under-18 users (#10548)
Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import {useMemo} from 'react'
|
||||
import {useMutation, useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {restrictChatSettings} from '#/state/queries/messages/restrictChatSettings'
|
||||
import {preferencesQueryKey} from '#/state/queries/preferences'
|
||||
import {useAgent, useSession} from '#/state/session'
|
||||
import {usePatchAgeAssuranceOtherRequiredData} from '#/ageAssurance'
|
||||
import {isUnderAge, maybeRestrictChatSettings} from '#/ageAssurance/util'
|
||||
import {isUnderAge} from '#/ageAssurance/util'
|
||||
import {IS_DEV} from '#/env'
|
||||
import {account} from '#/storage'
|
||||
|
||||
@@ -66,7 +67,11 @@ export function useBirthdateMutation() {
|
||||
})
|
||||
|
||||
if (isUnderAge(birthDate.toISOString(), 18)) {
|
||||
maybeRestrictChatSettings({agent})
|
||||
await restrictChatSettings({
|
||||
agent,
|
||||
restrictIncoming: true,
|
||||
restrictGroupInvites: true,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user