Align group invite settings with eligibility logic (#10748)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,22 @@ export function canBeAddedToGroup(profile: bsky.profile.AnyProfileView) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the effective `allowGroupInvites` value for a chat declaration.
|
||||
* When unset, group invites follow the general DM preference
|
||||
* (`allowIncoming`), which itself defaults to `following`. This mirrors the
|
||||
* `undefined` fallthrough in canBeAddedToGroup, and is the single source of
|
||||
* truth for both displaying and persisting the setting.
|
||||
*/
|
||||
export function resolveAllowGroupInvites(
|
||||
chat: {allowIncoming?: string; allowGroupInvites?: string} | undefined,
|
||||
): 'all' | 'none' | 'following' {
|
||||
return (chat?.allowGroupInvites ?? chat?.allowIncoming ?? 'following') as
|
||||
| 'all'
|
||||
| 'none'
|
||||
| 'following'
|
||||
}
|
||||
|
||||
export function localDateString(date: Date) {
|
||||
// can't use toISOString because it should be in local time
|
||||
const mm = date.getMonth()
|
||||
|
||||
Reference in New Issue
Block a user