align group invite settings with eligibility logic

The settings screen showed unset allowGroupInvites as "following", but
canBeAddedToGroup falls back to the general DM preference (allowIncoming)
when unset. Mirror that in the radio display, and on save fall back to
allowIncoming (then "following") and always write allowGroupInvites
(previously it was omitted when unset).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-06-05 16:43:07 +03:00
parent 7d4d7642fd
commit 764e84557d
2 changed files with 12 additions and 3 deletions
+6 -1
View File
@@ -201,7 +201,12 @@ export function MessagesSettingsScreenInner({}: Props) {
type="radio"
values={[
(profile?.associated?.chat
?.allowGroupInvites as AllowIncoming) ?? 'following',
?.allowGroupInvites as AllowIncoming) ??
// when unset, group invites follow the general DM
// preference (see canBeAddedToGroup)
(profile?.associated?.chat
?.allowIncoming as AllowIncoming) ??
'following',
]}
onChange={onSelectGroupInvitesFrom}>
<View>
@@ -35,7 +35,11 @@ export function useUpdateActorDeclaration({
current?.associated?.chat?.allowIncoming ??
'following'
const allowGroupInvites =
update.allowGroupInvites ?? current?.associated?.chat?.allowGroupInvites
update.allowGroupInvites ??
current?.associated?.chat?.allowGroupInvites ??
// when unset, group invites follow the general DM preference
// (see canBeAddedToGroup), so mirror that when persisting
allowIncoming
const result = await agent.com.atproto.repo.putRecord({
repo: currentAccount.did,
collection: 'chat.bsky.actor.declaration',
@@ -43,7 +47,7 @@ export function useUpdateActorDeclaration({
record: {
$type: 'chat.bsky.actor.declaration',
allowIncoming,
...(allowGroupInvites && {allowGroupInvites}),
allowGroupInvites,
},
})
return result