Skip to content

feat(contacts): admin-defined custom property types via app config - #5659

Open
fberke wants to merge 2 commits into
nextcloud:mainfrom
fberke:feat/custom-properties-config
Open

feat(contacts): admin-defined custom property types via app config#5659
fberke wants to merge 2 commits into
nextcloud:mainfrom
fberke:feat/custom-properties-config

Conversation

@fberke

@fberke fberke commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Allows admins to define custom property types (custom fields) for the contact editor via app config — no UI, a single occ command:

occ config:app:set contacts customProperties --value='[
  {"name": "x-customernumber", "label": "Customer number"},
  {"name": "x-region", "label": "Region", "force": "select",
   "options": [{"id": "NORTH", "name": "North"}, {"id": "SOUTH", "name": "South"}]}
]'

The fields show up in the "Add more info" menu and in the contact details, read-only and merge views like built-in fields, and are stored as regular X-… vCard properties, so they survive sync with other CardDAV clients.

Implements the config-based flavor of #3273 / #303.

How it works

  • A new CustomPropertiesService reads and validates the customProperties app config (JSON). Only x-… property names are accepted; invalid entries are dropped and logged, so a broken config can never break the app. The config schema is documented in the class docblock.
  • PageController provides the sanitized list as initial state.
  • The frontend merges the entries into the rfcProps registry at boot (src/models/customProperties.js), so all existing views pick them up without further changes.

Supported keys per entry: label, force (text, default, or select), options (TYPE parameter choices for text fields, value choices for select fields), multiple, primary, icon.

Notes / limitations

  • Labels are shown as configured (not translated) — they are admin-provided, instance-specific strings.
  • Editor types are limited to text and select for now.
  • Entries colliding with built-in property names are skipped.

Testing

  • Unit tests for the service (validation matrix) and the frontend merge function; PageControllerTest updated for the new constructor dependency.
  • Manually tested on Nextcloud 35.0.0 beta 4: fields appear in the editor, values round-trip through save/reload and appear in the vCard export as X-… properties.

🤖 Generated with Claude Code

Assisted-by: Claude:claude-fable-5
Signed-off-by: Frank Berke <fb@wtmr.de>
@SebastianKrupinski

Copy link
Copy Markdown
Contributor

Hi @fberke

Thank you for the PR. I had a quick look at the code, and noticed one thing, we require that any newly created front end files be created in typescript.

…nfig

Assisted-by: Claude:claude-fable-5
Signed-off-by: Frank Berke <fb@wtmr.de>
@fberke

fberke commented Aug 25, 2026

Copy link
Copy Markdown
Author

Thanks for the quick look! Fair point — I converted src/models/customProperties.js and its test to TypeScript in bc86685, typed against the config schema. Kept it as a fixup commit for now; I'll squash once the review is through.

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.

2 participants