diff --git a/src/features/people/capo-page.tsx b/src/features/people/capo-page.tsx
index 081ac6e0..0bd23082 100644
--- a/src/features/people/capo-page.tsx
+++ b/src/features/people/capo-page.tsx
@@ -173,7 +173,7 @@ export function CapoPage({ area }: { area: CapoArea }) {
{group.chatId}
- {group.admins ? null : No admins}
+ {group.admins === 0 ? No admins : null}
))}
diff --git a/src/features/people/people.contract.ts b/src/features/people/people.contract.ts
index b2ecf8be..55d43982 100644
--- a/src/features/people/people.contract.ts
+++ b/src/features/people/people.contract.ts
@@ -387,7 +387,8 @@ export type ImportPreview = z.infer
export const capoAreaSchema = z.object({
scope: z.string(),
- groups: z.array(groupSchema.extend({ admins: z.number().int() })),
+ // `admins` is null while the backend does not know a group's Telegram admins.
+ groups: z.array(groupSchema.extend({ admins: z.number().int().nullable() })),
admins: z.array(personRowSchema),
requests: z.array(z.object({ id: z.string(), person: personRefSchema, group: groupSchema, requestedOn: z.string() })),
})
diff --git a/tests/people-input.test.mjs b/tests/people-input.test.mjs
index ee1b01e2..aa7cf866 100644
--- a/tests/people-input.test.mjs
+++ b/tests/people-input.test.mjs
@@ -5,6 +5,7 @@ import { validateCensusImport } from "../src/features/people/census-import.serve
import {
askToBeAddedInputSchema,
campaignInputSchema,
+ capoAreaSchema,
createMemberInputSchema,
personInputSchema,
resolveReviewInputSchema,
@@ -48,3 +49,14 @@ void test("admission cannot claim a transfer upload that does not exist", () =>
false
)
})
+
+void test("the Capo area accepts groups whose Telegram admins the backend does not know", () => {
+ const area = (admins) => ({
+ scope: "Informatica",
+ groups: [{ chatId: "-1001", title: "Analisi 1", admins }],
+ admins: [],
+ requests: [],
+ })
+ assert.equal(capoAreaSchema.safeParse(area(null)).success, true)
+ assert.equal(capoAreaSchema.safeParse(area(2)).success, true)
+})