From cf9b30bfd681d3af1007d9d68b6a511a223f7ec2 Mon Sep 17 00:00:00 2001 From: Francisco Solla Date: Tue, 25 Aug 2026 10:30:07 -0300 Subject: [PATCH] =?UTF-8?q?fix(audit-p6-2):=20keep=20actor-options=20inlin?= =?UTF-8?q?e=20=E2=80=94=20exported=20options=20type=20tripped=20knip=20ty?= =?UTF-8?q?pes=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utilities/campaignPageActor.ts | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/utilities/campaignPageActor.ts b/src/utilities/campaignPageActor.ts index 5473d442..84601e04 100644 --- a/src/utilities/campaignPageActor.ts +++ b/src/utilities/campaignPageActor.ts @@ -10,18 +10,6 @@ import { getCampaignUser, getCampaignUserWithAvatar } from '@/utilities/campaign /** Exactly the non-null actor `getCampaignUser` proves (keeps its `email` refinement). */ export type CampaignPageActor = NonNullable>> -export type CampaignPageActorOptions = { - gate?: CampaignPageGate - redirectTo?: string - /** - * Load the actor with `avatar` populated (depth 1). The perfil shell renders - * `avatarUrl`, which requires the `avatar` relationship to be a populated - * media object — depth 0 would resolve it to a number id that the shell - * would treat as `null`. - */ - withAvatar?: boolean -} - export type CampaignPageGate = 'staff' | 'unrestricted' | 'noLeader' | 'writable' export { LEADER_CONTACTS_HOME } @@ -51,7 +39,14 @@ export const CAMPAIGN_STAFF_QUADRO_PATH = '/campanha/quadro' * call in a `(app)` route page outside this helper. */ export const requireCampaignPageActor = async ( - options: CampaignPageActorOptions = {}, + /** + * `withAvatar` loads the actor through `getCampaignUserWithAvatar` (avatar + * populated at depth 1) instead of `getCampaignUser` — both return + * `AuthenticatedCampaignUser | null`; the avatar depth is runtime-only and + * does not change the gates. The perfil shell renders `avatarUrl`, which + * requires the populated media object — depth 0 resolves to a number id. + */ + options: { gate?: CampaignPageGate; redirectTo?: string; withAvatar?: boolean } = {}, ): Promise => { const getter = options.withAvatar ? getCampaignUserWithAvatar : getCampaignUser const user = await getter()