Gate group chat invites on allowGroupInvites (#10546)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-05-19 21:47:54 +03:00
committed by GitHub
parent 12ab1dd2fd
commit 09253457f9
4 changed files with 31 additions and 11 deletions
+7 -5
View File
@@ -20,7 +20,7 @@ import {type ListMethods} from '#/view/com/util/List'
import {android, atoms as a, native, useTheme, web} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog'
import {canBeMessaged} from '#/components/dms/util'
import {canBeAddedToGroup, canBeMessaged} from '#/components/dms/util'
import * as TextField from '#/components/forms/TextField'
import * as Toggle from '#/components/forms/Toggle'
import {
@@ -246,6 +246,8 @@ export function InitiateChatFlow({
const items = useMemo(() => {
let _items: Item[] = []
const checker =
chatState === ChatState.NEW_GROUP_CHAT ? canBeAddedToGroup : canBeMessaged
if (isError) {
_items.push({
@@ -276,7 +278,7 @@ export function InitiateChatFlow({
}
_items = _items.sort(item => {
return item.type === 'profile' && canBeMessaged(item.profile) ? -1 : 1
return item.type === 'profile' && checker(item.profile) ? -1 : 1
})
}
} else {
@@ -299,7 +301,7 @@ export function InitiateChatFlow({
}
_items = _items.sort(item => {
return item.type === 'profile' && canBeMessaged(item.profile) ? -1 : 1
return item.type === 'profile' && checker(item.profile) ? -1 : 1
})
} else {
_items.push(...placeholders)
@@ -825,7 +827,7 @@ function GroupChatMemberProfileCard({
moderationOpts: ModerationOpts
}) {
const t = useTheme()
const enabled = canBeMessaged(profile)
const enabled = canBeAddedToGroup(profile)
const handle = sanitizeHandle(profile.handle, '@')
return (
@@ -845,7 +847,7 @@ function GroupChatMemberProfileCard({
<Text
style={[a.leading_snug, t.atoms.text_contrast_high]}
numberOfLines={2}>
<Trans>{handle} can’t be messaged</Trans>
<Trans>{handle} can’t be added</Trans>
</Text>
)}
</View>