Skip to content

feat(email): add email field type#31

Merged
vitormattos merged 26 commits intomainfrom
feat/email-field-type
Mar 21, 2026
Merged

feat(email): add email field type#31
vitormattos merged 26 commits intomainfrom
feat/email-field-type

Conversation

@vitormattos
Copy link
Member

Summary

Adds Email as a new profile field type, extending the existing catalog with backend normalization, workflow support, frontend input support, updated API schema, and regression tests.

Changes

Backend (PHP)

  • lib/Enum/FieldType.php: added EMAIL = 'email' and included it in values()
  • lib/Service/FieldValueService.php: added normalizeEmailValue() using FILTER_VALIDATE_EMAIL; includes email in normalization match and text-like search behavior
  • lib/Workflow/UserProfileFieldCheck.php: added email operators (is-set, not-is-set, is, not-is, contains, not-contains); for contains/not-contains, skips strict email normalization and performs substring evaluation
  • lib/ResponseDefinitions.php: added 'email' to ProfileFieldsType
  • lib/Service/FieldDefinitionValidator.php, ImportPayloadValidator.php, DataImportService.php: updated type unions to include email

Frontend (Vue 3 / TypeScript)

  • src/types/index.ts: FieldType union now includes 'email'
  • src/utils/workflowProfileFieldCheck.ts: email fields use text-style operator keys
  • src/views/AdminSettings.vue: added Email option in field type selector
  • src/views/PersonalSettings.vue: supports native email input type and inputmode mappings
  • src/components/AdminUserFieldsDialog.vue: added email descriptions, placeholders, input type/mode mappings, helper text, validation, and backend error message mapping

OpenAPI

Regenerated:

  • openapi.json
  • openapi-full.json
  • openapi-administration.json
  • src/types/openapi/openapi.ts
  • src/types/openapi/openapi-full.ts
  • src/types/openapi/openapi-administration.ts

Tests

PHP unit

  • FieldDefinitionValidatorTest: email definition acceptance
  • FieldValueServiceTest: email normalization accept/trim/reject cases
  • UserProfileFieldCheckTest: email contains operator execution/validation

Frontend (Vitest)

  • workflowProfileFieldCheck.spec.ts: email operator coverage
  • AdminSettings.spec.ts: Email option visibility
  • AdminUserFieldsDialog.spec.ts: email input rendering and helper text
  • PersonalSettings.spec.ts: email input rendering

Validation

  • docker compose exec -u www-data nextcloud ... composer test:unit ✅ (175 tests, 560 assertions)
  • npm run ts:check
  • npm run test ✅ (44 tests)
  • docker compose exec -u www-data nextcloud ... composer cs:fix
  • docker compose exec -u www-data nextcloud ... composer psalm ✅ (0 errors)
  • docker compose exec -u www-data nextcloud ... composer openapi

Screenshot

Admin → Profile fields → Create field → Type dropdown showing Email option:

Email field type in admin dropdown

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos merged commit 4a166c1 into main Mar 21, 2026
21 checks passed
@vitormattos vitormattos deleted the feat/email-field-type branch March 21, 2026 02:35
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