https://sonarly.com/issue/33360?type=bug
The `resendEmailVerificationToken` method hardcodes `EmailVerificationTrigger.SIGN_UP`, so users who updated their email and request a resend receive "Welcome to Twenty: Please Confirm Your Email" instead of "Please confirm your updated email".
Fix: **What changed:** Added support for an optional `verificationTrigger` parameter in the resend email verification flow, threading it from the GraphQL mutation through the resolver to the service layer.
**6 files changed:**
1. **`email-verification.constants.ts`** — Added `registerEnumType(EmailVerificationTrigger, ...)` so the enum is exposed as a GraphQL enum type. This follows the same pattern used for `WorkspaceActivationStatus`, `AnalyticsType`, `OnboardingStatus`, and other enums in the codebase.
2. **`resend-email-verification-token.input.ts`** — Added an optional `verificationTrigger` field to the DTO with `@Field(() => EmailVerificationTrigger, { nullable: true })`, `@IsOptional()`, and `@IsEnum(EmailVerificationTrigger)` decorators.
3. **`email-verification.resolver.ts`** — Passes `resendEmailVerificationTokenInput.verificationTrigger` as a fourth argument to the service method.
4. **`email-verification.service.ts`** — The `resendEmailVerificationToken` method now accepts a `verificationTrigger` parameter (defaulting to `SIGN_UP`) and passes it to `sendVerificationEmail` instead of the hardcoded value.
5. **`resendEmailVerificationToken.ts` (frontend mutation)** — Added `$verificationTrigger: EmailVerificationTrigger` variable to the GraphQL mutation.
6. **`useHandleResendEmailVerificationToken.ts` (frontend hook)** — Added an optional `verificationTrigger` parameter that gets spread into the mutation variables when provided.
**Backward compatibility:** All existing callers (in `EmailVerificationSent.tsx`) pass only `email` — the trigger defaults to `SIGN_UP`, preserving the current sign-up verification behavior. The hook is now ready for email update contexts to pass `'EMAIL_UPDATE'`.
**Note:** After merging, `npx nx run twenty-front:graphql:generate --configuration=metadata` should be run to regenerate the frontend GraphQL types to include the new enum and mutation argument.