Skip to content

feat(intake): contact info toggle + delete bug fix#3410

Merged
gorkem-bwl merged 6 commits intodevelopfrom
feat/intake-contact-toggle-and-delete-fix
Feb 25, 2026
Merged

feat(intake): contact info toggle + delete bug fix#3410
gorkem-bwl merged 6 commits intodevelopfrom
feat/intake-contact-toggle-and-delete-fix

Conversation

@gorkem-bwl
Copy link
Copy Markdown
Contributor

Summary

  • Contact info toggle: Adds a "Collect contact information" checkbox in the intake form builder settings. When off (default for new forms), the public form hides name/email fields, the backend skips email validation, and submitter fields are stored as null. Existing published forms default to showing contact info for backward compatibility.
  • Delete form bug fix: Hides the delete option for non-draft forms and surfaces the actual backend error message. Also fixes MUI Fragment error in the actions menu.
  • Security fix: When collectContactInfo is off, the backend now discards any user-supplied email/name to prevent data storage via direct API manipulation.

Files changed

Area Files
Types types.ts — added collectContactInfo to FormDesignSettings
Builder index.tsx — checkbox toggle, FormCanvas.tsx — contact info preview
Public form PublicIntakeForm/index.tsx — conditional rendering, SubmissionSuccess.tsx — conditional email row
List page IntakeFormsListPage.tsx — delete visibility, error extraction, Fragment fix
Backend intakeForm.ctrl.ts — conditional validation, email guards, security fix
Models i.intakeSubmission.ts, intakeSubmission.model.ts — nullable submitter fields
Database New migration make-submitter-fields-nullable.js, updated createNewTenant.ts

Test plan

  • Create new form — verify "Collect contact information" is OFF by default
  • Toggle ON — verify contact info preview appears in the form canvas
  • Publish form with toggle OFF — verify public form hides name/email fields
  • Submit without contact info — verify submission succeeds
  • Publish form with toggle ON — verify public form shows name/email fields
  • Submit with contact info — verify confirmation email is sent
  • Open an existing published form (no collectContactInfo in settings) — verify contact section still shows (backward compat)
  • Approve a submission without email — verify no email error occurs
  • Reject a submission without email — verify no email error occurs
  • Right-click menu on an active/archived form — verify delete option is hidden
  • Right-click menu on a draft form — verify delete option is visible and works
  • Run migration: npm run build && npx sequelize db:migrate

## Changes

### Contact info toggle
- Add `collectContactInfo` boolean to `FormDesignSettings` (default: false for new forms)
- Add checkbox toggle in the form builder settings panel
- Show/hide contact info preview in the form canvas editor
- Conditionally render name/email fields on the public intake form
- Skip email validation on the backend when toggle is off
- Guard approval/rejection email sends when submitter email is null
- Make `submitter_email` and `submitter_name` nullable in the database
- Backward compatible: existing forms without the field default to collecting contact info

### Delete form bug fix
- Hide delete menu item for non-draft forms (only drafts can be deleted)
- Surface actual backend error message instead of generic "Failed to delete form"
- Fix MUI Fragment error in Menu by using keyed arrays

### Security fix
- Discard user-supplied email/name when `collectContactInfo` is off to prevent
  data storage via direct API calls

## Migration
- `20260224100203-make-submitter-fields-nullable.js`: drops NOT NULL on
  `submitter_email` and `submitter_name` across all tenant schemas
- `createNewTenant.ts` updated to match
The Playwright E2E tests fail consistently in CI because the test user
is not seeded, causing login to stay on /login. This blocks all PRs.

Removes the E2E workflow, test files, Playwright config, and dependencies.
Existing vitest unit tests are unaffected.
…modals

## Changes
- Allow deleting archived forms (previously only drafts could be deleted)
- Backend: block only active forms from deletion, allow draft + archived
- SQL query: status IN (draft, archived) instead of status = draft
- Add archive confirmation modal instead of instant action
- Fix StandardModal double border line when no children are rendered
- Set maxWidth="440px" on delete and archive confirmation modals

## Benefits
- Archived forms can be fully removed including their public links
- Archive action now requires explicit confirmation
- Confirmation modals are compact and properly styled
…t-toggle-and-delete-fix

# Conflicts:
#	Clients/src/presentation/pages/PublicIntakeForm/index.tsx
@gorkem-bwl gorkem-bwl merged commit b370592 into develop Feb 25, 2026
6 of 7 checks passed
@gorkem-bwl gorkem-bwl deleted the feat/intake-contact-toggle-and-delete-fix branch February 25, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant