This repository was archived by the owner on May 29, 2026. It is now read-only.
feat(CnFilesTab+CnSchemaFormDialog): schema-driven default for "Automatically publish" toggle#455
Open
WilcoLouwerse wants to merge 3 commits into
Open
feat(CnFilesTab+CnSchemaFormDialog): schema-driven default for "Automatically publish" toggle#455WilcoLouwerse wants to merge 3 commits into
WilcoLouwerse wants to merge 3 commits into
Conversation
Adds an `NcCheckboxRadioSwitch` above the dropzone that controls the
`share` flag sent on multipart upload (matches the OpenRegister
`filesMultipart` endpoint's `share` field).
New props (all backward-compatible, safe defaults):
- `showShareToggle: Boolean = true` — hide to force `share=false`
- `defaultShare: Boolean|null = null` — initial value; `null` triggers
schema lookup
- `shareLabel: String` — toggle label, translatable
When `defaultShare` is `null`, the component fetches the active
schema (`apiBase/schemas/{schema}`) and reads
`configuration.defaultAutoShare`. A truthy value seeds the toggle on;
network failures or a missing key keep the safe default (off). A
non-null `defaultShare` always wins over the schema lookup so
consumers can override.
`share=…` is appended to the upload `FormData` only when the toggle
is visible; with `showShareToggle=false` the parameter is omitted
(equivalent to "don't auto-publish").
Addresses ConductionNL/opencatalogi#577 — the previous toggle lived
in opencatalogi's UploadFiles.vue, which is no longer mounted in the
manifest-driven shell. CnFilesTab is the active surface (rendered
inside CnObjectSidebar's Files tab), so the user-facing fix belongs
here.
Tests: 2619 / 2619 pass; check:jsdoc green at baseline; check:docs
covers the regenerated CnFilesTab.md partial.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
3 tasks
Pairs with the read-side CnFilesTab change earlier on this branch: the admin can now flip `configuration.defaultAutoShare` directly in the Configuration tab of the schema editor, instead of needing to hit the OpenRegister schemas API by hand. Changes: - `CnSchemaConfigurationTab.vue`: NcCheckboxRadioSwitch bound to `schema.configuration.defaultAutoShare`, placed under the existing `autoPublish` toggle. - `CnSchemaFormDialog.vue`: add `defaultAutoShare: false` to both `data().schemaItem.configuration` and the `initializeSchemaItem()` defaults block; add the matching `=== undefined → false` shim so legacy schemas without the key render the checkbox unchecked (not undefined → "indeterminate" state). Backward-compatible: schemas that don't opt in keep the toggle off exactly as before; existing whitelisted keys (allowFiles, autoPublish, …) are untouched. Tests: 2619 / 2619 pass. JSDoc baseline holds. No new docs partial generated (the change is v-model + data() — no public prop / slot / event surface). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
4 tasks
rubenvdlinde
pushed a commit
to ConductionNL/openregister
that referenced
this pull request
May 27, 2026
…1944) `Schema::validateConfigurationArray()` strips any configuration key not in its allow-list. Adds `defaultAutoShare` to the `$boolFields` whitelist so schemas can persist the new key without it being silently dropped on save. Read by the attachment-upload dialog (CnFilesTab in @conduction/nextcloud-vue, and UploadFiles.vue in opencatalogi) to seed the "Automatically publish" toggle. true = toggle on by default; absent / false = toggle off (existing behaviour). Users can override per upload — the schema value never coerces the final submitted `share` field. Companion to: - ConductionNL/nextcloud-vue#455 (CnFilesTab share toggle) - ConductionNL/opencatalogi#723 (UploadFiles legacy modal parity) Closes ConductionNL/opencatalogi#577 (backend half). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
remko48
suggested changes
May 28, 2026
…l10n, docgen path
- defaultShare: replace `type: Boolean` (rejected `null`) with a
`validator` that accepts `null | boolean`. Vue 2 now stops emitting
`Invalid prop` warnings when a consumer passes `:default-share="null"`.
- Watchers: fold the schema + defaultShare immediate watchers into the
single `objectId` watcher every other CnObjectSidebar tab uses, so
the schema lookup fires once on mount instead of twice concurrently.
- applyShareDefault: log the swallowed fetch error so a missing toggle
default is debuggable — matches every other catch in this file.
- l10n: add the two new strings ("Automatically publish", "Default
\"Automatically publish\" toggle …") to en.json + nl.json so the
translation tooling no longer flags them as missing.
- docgen: stamp the real SFC path (resolved against componentsRoot)
instead of the assumed `src/components/<displayName>/...` pattern,
which was wrong for every nested component (CnFilesTab,
CnAiInput, every CnObjectSidebar/* tab, …). Regenerated all
partials so the stamps are now accurate.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
remko48
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CnFilesTab): adds anNcCheckboxRadioSwitchabove the dropzone that controls theshareflag sent on multipart upload (matches the OpenRegisterfilesMultipartendpoint'ssharefield).CnSchemaFormDialog): adds a boolean checkbox under the Schema-configuration section so admins can setconfiguration.defaultAutoShareper schema. Defaultfalse; lifts via the standard{...defaults, ...item}spread so the value survives schema edits.CnFilesTabprops (all backward-compatible, safe defaults):showShareToggle: Boolean = true— hide to forceshare=falsedefaultShare: Boolean|null = null— initial value;nulltriggers schema lookupshareLabel: String— toggle label, translatabledefaultShare === null, the component fetchesapiBase/schemas/{schema}and seeds fromconfiguration.defaultAutoShare. Any failure (network, missing key, non-boolean value) keeps the safe default (off).Why
Closes the library half of ConductionNL/opencatalogi#577. The previous attachment-upload toggle lived in
opencatalogi/src/modals/generic/UploadFiles.vue, which is no longer mounted in the manifest-driven shell.CnFilesTabis the active surface (rendered insideCnObjectSidebar's Files tab), so the user-facing fix belongs here.The sibling opencatalogi PR (ConductionNL/opencatalogi#723) keeps the legacy modal in lockstep so a future re-wire — or any legacy consumer still importing it — lands the same behaviour. Backend persistence of the new
configuration.defaultAutoSharekey requires ConductionNL/openregister#1944 (whitelists the key inSchema::validateConfigurationArray()).Backward compatibility
CnFilesTabprops have safe defaults:showShareToggle: true,defaultShare: null,shareLabel: t('nextcloud-vue', 'Automatically publish').register/schema/objectIdthe lookup short-circuits, exactly as today.configuration.defaultAutoSharekeep the toggle off — net behaviour matches today's no-toggle default.:show-share-toggle="false"to opt out of the toggle entirely;shareis then omitted from the upload form data.CnSchemaFormDialogcheckbox is additive — schemas without an explicitdefaultAutoSharecontinue to render with the field unset.Test plan
npm test— 2619 / 2619 passnpm run check:jsdoc— green at baselinenpm run check:docs— greenprebuild:docsregenerateddocs/components/_generated/CnFilesTab.md(committed)configuration.defaultAutoShare: true, open the Files tab on an object of that schema → toggle is on; flip off, upload → backend receivesshare=false. On a schema without the key, toggle is off. From the schema-edit dialog, the new checkbox round-trips correctly.🤖 Generated with Claude Code
Review feedback
Review feedback Remko & Thijn verwerkt in 88f323a — prop type, watcher dedupe, l10n, docgen path.