From 5e8c92ed4de4f00f900fe4cd23668ac467ba815f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 10 Mar 2023 13:13:54 -0600 Subject: [PATCH] groupSchema: refine --> transform, fix type of members_count --- app/soapbox/schemas/group.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/soapbox/schemas/group.ts b/app/soapbox/schemas/group.ts index 74246adbc..964831c1d 100644 --- a/app/soapbox/schemas/group.ts +++ b/app/soapbox/schemas/group.ts @@ -24,13 +24,13 @@ const groupSchema = z.object({ id: z.string().catch(''), locked: z.boolean().catch(false), membership_required: z.boolean().catch(false), - members_count: z.number().optional().catch(undefined), + members_count: z.number().catch(0), note: z.string().catch('').refine(note => note === '

' ? '' : note), - relationship: groupRelationshipSchema.optional().catch(undefined), // Dummy field to be overwritten later + relationship: groupRelationshipSchema.nullable().catch(null), // Dummy field to be overwritten later statuses_visibility: z.string().catch('public'), uri: z.string().catch(''), url: z.string().catch(''), -}).refine(group => { +}).transform(group => { group.avatar_static = group.avatar_static || group.avatar; group.header_static = group.header_static || group.header; group.locked = group.locked || group.group_visibility === 'members_only'; // TruthSocial