Skip to content

Commit c45dd80

Browse files
feat(setup): Setup → Configuration → Public forms lists and switches every public form (#36697)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8KF3BvUnBEoN52Vcnw6JhXg)_ Part of #36444. This PR is the card's **Settings = operations** half (ruling items 6–10 of #36444 (comment)). The **Studio = design** half (items 1–5: the designer under the object, create/delete, fields, sections, address, live preview) stays open on the card for a second PR on this branch. Clause-②: yes (widening) — a new `@objectstack/spec/ui` export `anonymousFormIntakeWithdrawnIn` (moved verbatim from `@objectstack/metadata-core`, which re-exports it), a new Setup navigation id `nav_public_forms`, a new component id `forms:public-forms`, and new language-pack keys (the `publicFormsSetup` block and the nav label) in every shipped locale Metadata-protocol: none ## 维护者速读 - 设置 › 配置 新增「对外表单」:列出本环境所有对外表单(名称、所属对象、地址、开关),可一键关闭/开启、复制地址、在新标签打开。仅系统管理员可见。 - 关闭后表单地址立即打不开(与现在一致,返回「找不到表单」),表单仍留在列表里可随时重新开启。 - 已安装应用的表单,开关存为本环境的定制,不改应用本身,应用升级照常进来;重新开启且没有其它改动时,自动恢复为应用原样。 - 表单的设计(新建、删除、字段、标题)仍在 Studio,下一个 PR 做;「最近一次提交时间」本卡不做。 ## What changes - **New Setup page `forms:public-forms`** (Setup → Configuration → Public Forms, `nav_public_forms`, `requiredPermissions: ['manage_platform_settings']`; the page asks the same capability). One row per public form: name, the object a submission creates a record of, its address, an on/off switch, copy address, open in a new tab. No field editing, create or delete here (ruling item 7). - **Which forms are listed** (`ui/packages/app-shell/src/views/setup/publicForms.ts`): read from the effective view list (`GET /meta/view`), judged by the server's own rule `anonymousFormIntakeCandidates` (`@objectstack/spec/ui`), never a second reading of `sharing`: - listed = the rule would open the form with its switch on (`allowAnonymous: true` + a `publicLink`), so a switched-off form stays listed (item 8); - on = the rule opens it as served. - The name shown is the served label, else the form's title, else its first section's label, else its key. - **Where a switch is saved** (item 9): the switch is `sharing.enabled`, saved and published at once. - Writable package → saved in that package. - Installed (read-only) app → a declared override in the app's `.custom` package (ADR-0146 D2/D3), via the same seams the in-page dashboard editor uses (`resolveDashboardEditTarget`, `ensureDashboardSaveTarget`, `overrideDraftBody`, `saveAndPublishInPackage`). The app's own package is never written, so upgrades still flow in. - Switching back on removes the override (the pair's row) when it held nothing but the switch, so the app's original form is served again; an override that also carries design changes keeps them, with the switch on. - A pending draft where the switch would save is never published or removed on its saver's behalf: the switch writes nothing and says so. - After an app upgrade, an override taken from an earlier version is still restored when the form is otherwise the app's current one. When it is not, it is kept with the switch on, and the page says the form stays on the app's earlier version (`basedOn`), which Studio's "Restore package original" undoes. The app's earlier document cannot be read, so a switch-only override at an old version cannot be told from a design one (review S1). - **A form its installed app ships switched off** (address kept, `enabled: false` or `allowAnonymous: false`, or `enabled` omitted, which the stack schema parses as `false`) is withdrawn by the app's own document, and the routes never let an override re-open it (pinned in `packages/rest/src/public-form-withdrawal-effective-read.test.ts`). The page judges the app's document with the routes' own function, `anonymousFormIntakeWithdrawnIn`, against the served form switched on (slot or slug match), plus an omitted `enabled` (review M1, S2). The page reads each installed app's form's layers (`markShippedOff`, one package-list read per page load) and lists such a form as "Off (switched off by its app)" with its switch disabled, even when an override already switches it on; a switch-on writes nothing and refuses with that sentence. A form whose app's document cannot be read shows "Unknown", never On (N5). - **`anonymousFormIntakeWithdrawnIn` moves into `@objectstack/spec/ui`** (`anonymous-form-intake.ts`, beside the candidates half), verbatim: it is a pure judgement of the bodies it is handed. `@objectstack/metadata-core` re-exports the same binding, so the routes' import is unchanged, and its identity test now pins this name with the others (one copy, not a twin). Spec `api-surface` and `export-origins` regenerated (1 added). - **Permission:** the page asks `manage_platform_settings` (its Setup entry's); the switches also ask `manage_metadata`, the capability the server checks on every write they make. Without it the forms are listed, the switches are disabled, and a sentence says why. A refused switch is told in business words (403 → no permission; anything else → the server refused, try again), and so is a failed list read; the server's own message goes to the console log only (review N1, N3, N6). - **Switched-off behaviour (F3 = A):** unchanged, `404 FORM_NOT_FOUND`. The routes already honour an override that withdraws a base's form (`anonymousFormIntakeWithdrawnIn`), so no route, spec key, error code or stored-key change was needed: Metadata-protocol stays `none`. The new spec export (the moved withdrawal judgement), the new navigation id, component id and language keys are the widening the Clause-② line declares. - Business wording only (item 10): new `publicFormsSetup` block in all 11 console locales; nav label in all 11 platform-object locales (zh-CN 「对外表单」). - Access restrictions (password, expiry, domains) are exposed on neither surface, per the ruling. - **Not built: "last submission time".** A submission is an ordinary record of the form's object and records no form, so there is nothing to read (stated in the ruling). ## Tests - `ui/packages/app-shell/src/views/setup/publicForms.test.ts` (26 cases): the listing rule (on, off-but-listed, internal forms, non-form views, naming); writable-package save; installed app off → override in `.custom` with its `overrides` declaration and nothing in the app; reading the base when the listed pair does not hold the form; on with a switch-only override → restore (reset at the pair, no save); on with a design override → kept, switch on, `basedOn` unchanged; pending draft → nothing written (both the client-side check and the server's `409 METADATA_CONFLICT`); refusals (package not listed, unreadable form, no version to declare); a base shipped off, both `enabled: false` and absent `enabled`, refused with nothing written, with and without an override already on, and listed as not on (`markShippedOff`); an app that ships `allowAnonymous: false` under an override that opens it, refused and listed as not on; an unreadable app document → `unknown`, not on; an override switch-only at `basedOn: 2.0.0` against a changed 3.0.0 base → `{ kind: 'earlier-version', basedOn: '2.0.0' }`, kept; the same against an unchanged base → restored. Ablations: dropping the refusal, the listing mark, the earlier-version answer, the routes' withdrawal rule, or the unknown mark, or reading an absent switch as on, each turns cases red. - `PublicFormsSetupPage.test.tsx` (8 cases, rendered): the Setup capability gate; without `manage_metadata` the switches are disabled with the sentence; a shipped-off form shows "switched off by its app" with a disabled switch (both spellings); the pending-draft toast leaves the row as it was; a 403 and a 500 are told by key, with no server text; a failed list read shows the business sentence without the server text; an unreadable app document shows "Unknown", not On. Ablations of the metadata gate, the shipped-off mark and the business-word refusal each turn a case red. - `PublicFormsSetupPage.navContribution.test.tsx` (3 cases): the ref is registered by the production registration, addresses `component/forms/public-forms`, and mounts through the component route. - `packages/metadata-core/src/anonymous-form-intake.test.ts`: the identity case now includes `anonymousFormIntakeWithdrawnIn` (metadata-core's export is the spec binding); the package's 1,057 tests pass, and so does `packages/rest/src/public-form-withdrawal-effective-read.test.ts`. - `packages/cli/test/connect-agent-both-halves-wire.pin.test.ts`: Setup nav count 34 → 35, plus `nav_public_forms` is served to a `manage_platform_settings` holder. Red without the fix: against a platform-objects build without the nav entry it fails `expected [...] to have a length of 35 but got 34`. - `ui/packages/i18n/src/__tests__/zh-hant-generated.test.ts`: passes with `src/locales/zh-Hant.ts` regenerated from zh (`pnpm --filter @object-ui/i18n gen:zh-hant`). - `ui/packages/app-shell/src/console/__tests__/openPathObjectReaders-12811.test.ts`: the new page's `useMetadata().objects` read is classified `off` (Setup, not an app object-list open). ## Acceptance notes Live run on `examples/app-crm` (`objectstack dev --seed-admin --fresh`) + console dev server, as the seeded admin. `com.example.crm` lists as not writable, so this exercised the installed-app (customization) path: | Step | Result | |---|---| | Open Setup → Configuration → Public Forms | 1 row, "Contact us", Lead, `…/f/contact-us`, On | | Switch off | toast; row Off; `GET /api/v1/forms/contact-us` → `404 FORM_NOT_FOUND`; `/f/contact-us` shows "Page not found" | | Reload the page | still listed, still Off | | Switch on | `GET /api/v1/forms/contact-us` → 200; the form renders and takes input again | | Layers after switching on | `effective._packageId = com.example.crm`, no override left in `com.example.crm.custom` (restored to the app original) | Screenshots (live run, 2× scale) are in the project's shared files under `issue-36444/`; they cannot be uploaded to GitHub from the cloud seat: - `01-public-forms-on.png`: the page with the Setup sidebar entry, form On. - `02-public-forms-off.png`: after switching off (toast, Off). - `03-anon-form-off.png`: the anonymous address while off. - `04-public-forms-back-on.png`, `05-anon-form-on.png`: switched back on, the form takes input again. The Studio designer screenshot comes with the second PR. Premise finding for the Studio half: the existing Developer → Public Forms entry (`nav_public_forms` in `studio.app.ts`, `developer:public-forms`) is served only where a host loads `@objectstack/studio`; no example and no CLI default loads it, so the console's own Studio has no public-forms entry today. The second PR places the designer under the object in the console's Studio, within the seven-tab Data pillar (objectui#12450). Overlap: merges cleanly with `main`, #36629 and #36525. #34223 (draft since 11-19) also bumps the same Setup nav count line in the CLI pin test; whichever lands second takes the other's count. ## Verification Head `2a859fb0a4` (review round 2: S2, N5, N6; round 1 at `d91c73bcad`; `main` merged in earlier as `33a41ea1b0`, no rebase). - The derived gate union (`dispatch-gates --commands`, now 94 commands with the spec and metadata-core paths): 94/94 exit 0 on `2a859fb0a4`. - CI on `2a859fb0a4`: all workflows completed (Spec Liveness Check included), 59 checks success, 10 skipped (opt-in, queue and schedule gates), 0 failure. - `@object-ui/app-shell` type-check (src + tests): exit 0. eslint on the changed files: 0 errors. - Locale keys in all 11 console locales; zh-Hant regenerated from zh (`gen:zh-hant`). - Earlier heads: `a502b8c57` had two reds, fixed in `d3b3b09d3` (`check:spec-symbols` refused a local type `Doc`, renamed `FormDoc`; the `openPathObjectReaders-12811` census, classified). `d3b3b09d3` had one red, Test UI (10/16), the stale zh-Hant locale, fixed in `5c7d009426`. `8902d697ee` and `d91c73bcad` were all green. - Locally `peopleAssignments.navContribution.test.tsx` ("Position holders" heading) fails on `main` as well; CI runs it green. Not touched here. --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbWoxCrkYwcqxxENvmn)_ <!-- signed: repo:objectstack#1 · os-warren · session_01JQwxbWoxCrkYwcqxxENvmn --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 70f454a commit c45dd80

48 files changed

Lines changed: 1955 additions & 121 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
'@objectstack/platform-objects': patch
5+
'@objectstack/spec': patch
6+
'@objectstack/metadata-core': patch
7+
---
8+
9+
feat(setup): Setup → Configuration → Public forms lists every public form of the environment and switches it on or off
10+
11+
Clause-②: yes (widening) — a new Setup navigation id `nav_public_forms`, a new component id `forms:public-forms`, new language-pack keys (the `publicFormsSetup` block and the nav label) in every shipped locale, and `anonymousFormIntakeWithdrawnIn` newly exported from `@objectstack/spec/ui` (moved from `@objectstack/metadata-core`, which re-exports the same binding)
12+
Metadata-protocol: none
13+
14+
A system administrator (`manage_platform_settings`, the capability the Setup entry asks) now has one page for the operations side of public forms. It lists every public form of the environment: its name, the object a submission creates a record of, its address, and whether it is on. Per row: switch it on or off, copy its address, or open it in a new tab. A form is designed (created, deleted, its fields and title changed) in Studio, not here.
15+
16+
- **Which forms are listed.** A form view whose `sharing` opens it to anonymous intake once switched on (`allowAnonymous: true` and a `publicLink`), read by the same rule the anonymous form routes use (`anonymousFormIntakeCandidates`). A switched-off form stays listed and can be switched back on. A form with no public address or no anonymous access is an internal form and is not listed. The list is the effective one (`GET /meta/view`), so an installed app's form switched off in this environment lists as off.
17+
- **Where a switch is saved.** The switch is the form's `sharing.enabled`, saved and published at once. A form of a writable package is saved in that package. A form of an installed (read-only) app is saved as this environment's customization, an override in the app's `.custom` package (ADR-0146), never an edit of the app's own package, so the app upgrades as before. Switching such a form back on removes the override when it held nothing but the switch, so the app's own form is served again; an override that also carries design changes keeps them, with the switch on.
18+
- **A form its installed app ships switched off** (its address kept, `enabled` or `allowAnonymous` set to `false`, or `enabled` omitted, which the stack schema reads as `false`) stays closed whatever the environment saves: the anonymous routes treat the app's own document as a withdrawal that no override re-opens. The page judges this with the routes' own function, `anonymousFormIntakeWithdrawnIn`, now declared in `@objectstack/spec/ui` beside the rest of the intake rule; `@objectstack/metadata-core` re-exports the same binding, so the server's import is unchanged. The page lists such a form as "Off (switched off by its app)" with its switch disabled, also when an override already switches it on, and a switch-on writes nothing and says the app ships it switched off. A form whose app's document cannot be read is shown as status unknown, never as on.
19+
- **After an app upgrade**, switching back on an override taken from an earlier version restores the app's own form when the form is otherwise unchanged. When it is not, the override is kept with the switch on and the page says the form stays on the app's earlier version, which Studio's "Restore package original" undoes.
20+
- A switch over a draft already pending where it would save writes nothing and says so: that draft is its saver's and is never published on their behalf.
21+
- A switch writes the form's metadata, which the server lets only a `manage_metadata` holder do. Without it the page still lists the forms but disables the switches and says why. A refused switch, and a list read that fails, are told in business words, never the server's raw message.
22+
- A switched-off form keeps answering as it does today: `404 FORM_NOT_FOUND` at its address. No route, error code or stored key is added.
23+
24+
New Setup navigation entry `nav_public_forms` in `group_configuration` (label "Public Forms", in every shipped locale) opening the component `forms:public-forms`; the Setup navigation now carries 35 entries. New locale block `publicFormsSetup` in every console locale. Not shown: when a form last took a submission, since a submission is an ordinary record of the form's object and records no form.

‎packages/cli/test/connect-agent-both-halves-wire.pin.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,15 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
277277
// `group_apps` held here, so that group collapses too; 31 until the
278278
// Units of Measure entry, `nav_units_of_measure`, joined Configuration
279279
// (#35488); 32 until the working-calendar pair, `nav_work_calendars`
280-
// and `nav_work_calendar_exceptions`, joined it, ADR-0157.)
280+
// and `nav_work_calendar_exceptions`, joined it, ADR-0157; 34 until
281+
// the public forms entry, `nav_public_forms`, joined it, #36444.)
281282
// `nav_settings_branding` is not among them, and not because of a
282283
// tenancy wall (this harness boots none): since #24766 it is
283284
// contributed by `@objectstack/service-settings` together with the
284285
// `branding` namespace, offered only where no organization wall stands,
285286
// and this harness composes platform-objects and the MCP bundle alone.
286-
expect(allowedIds).toHaveLength(34);
287+
expect(allowedIds).toHaveLength(35);
288+
expect(allowedIds).toContain('nav_public_forms');
287289
expect(allowedIds).toContain('nav_work_calendars');
288290
expect(allowedIds).toContain('nav_work_calendar_exceptions');
289291
expect(allowedIds).not.toContain('nav_packaged_actions');
@@ -312,8 +314,8 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', (
312314
expect(withAccountHalf.statusCode).toBe(200);
313315
expect(withoutAccountHalf.statusCode).toBe(200);
314316
expect(navIds(withAccountHalf.body?.item)).toEqual(navIds(withoutAccountHalf.body?.item));
315-
// 34: the composition the count in the test above states.
316-
expect(navIds(withAccountHalf.body?.item)).toHaveLength(34);
317+
// 35: the composition the count in the test above states.
318+
expect(navIds(withAccountHalf.body?.item)).toHaveLength(35);
317319

318320
// The mechanism behind the invariance, asserted rather than assumed:
319321
// the bundle aims exactly one contribution at `setup` and one at

‎packages/metadata-core/src/anonymous-form-intake.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,14 @@ describe('anonymousFormIntakeWithdrawnIn — an explicit withdrawal of the same
322322
// The candidates half is declared in `@objectstack/spec/ui` and re-exported by
323323
// this package. "One copy" is checkable only as IDENTITY: a wrapper or a copy
324324
// answers the same today and drifts tomorrow, while the same binding cannot.
325-
describe('the candidates and object-name halves are the spec bindings themselves, re-exported (one copy, not a copy)', () => {
325+
describe('the candidates, object-name and withdrawal halves are the spec bindings themselves, re-exported (one copy, not a copy)', () => {
326326
const NAMES = [
327327
'publicFormSlug',
328328
'anonymousFormIntakeSlug',
329329
'anonymousFormIntakeCandidates',
330330
'anonymousFormIntakeSlugs',
331331
'anonymousFormObjectName',
332+
'anonymousFormIntakeWithdrawnIn',
332333
] as const;
333334

334335
it.each(NAMES)('%s: this module and the package barrel export the @objectstack/spec/ui function', (name) => {

‎packages/metadata-core/src/anonymous-form-intake.ts‎

Lines changed: 7 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,23 @@ import {
4141
postureEnforcesWall,
4242
type TenancyPosture,
4343
} from '@objectstack/spec/security';
44-
import { publicFormSlug, type AnonymousFormIntakeCandidate } from '@objectstack/spec/ui';
44+
import type { AnonymousFormIntakeCandidate } from '@objectstack/spec/ui';
4545
import { applyInjectedSystemColumns } from './injected-system-columns.js';
4646
import { resolveRecordWallOrganizationField } from './record-organization.js';
4747

4848
// The candidates half of the rule — which form candidates a `view` body opens
49-
// to anonymous intake — and the object-name half (`anonymousFormObjectName`,
50-
// the object a candidate submits into) live in `@objectstack/spec/ui` beside the
51-
// `SharingConfigSchema` it reads, so a console can import the same rule the
52-
// doors serve. Re-exported here as the SAME bindings (never a wrapper or a
49+
// to anonymous intake — the object-name half (`anonymousFormObjectName`, the
50+
// object a candidate submits into) and the withdrawal half
51+
// (`anonymousFormIntakeWithdrawnIn`, whether a layer's body withdraws a
52+
// candidate) live in `@objectstack/spec/ui` beside the `SharingConfigSchema`
53+
// they read, so a console can import the same rule the doors serve. Re-exported here as the SAME bindings (never a wrapper or a
5354
// copy), so every server caller keeps importing it from this package and the
5455
// two entries cannot disagree; the identity is pinned in this module's test.
5556
export {
5657
anonymousFormIntakeCandidates,
5758
anonymousFormIntakeSlug,
5859
anonymousFormIntakeSlugs,
60+
anonymousFormIntakeWithdrawnIn,
5961
anonymousFormObjectName,
6062
publicFormSlug,
6163
} from '@objectstack/spec/ui';
@@ -196,108 +198,3 @@ export function anonymousFormIntakeUnavailableMessage(slug: string, u: Anonymous
196198
);
197199
}
198200

199-
/**
200-
* Where a form sits in a `view` body, independent of its content: the nested
201-
* `form`, one `formViews` entry, or the flattened `config`.
202-
*/
203-
function anonymousFormSlot(view: Record<string, any>, candidate: AnonymousFormIntakeCandidate): string {
204-
if (candidate.form === view.form) return 'form';
205-
if (candidate.key !== undefined && view.formViews?.[candidate.key] === candidate.form) {
206-
return `formViews:${candidate.key}`;
207-
}
208-
return 'config';
209-
}
210-
211-
/**
212-
* The forms a `view` body EXPLICITLY withdraws, with their slot and slug: a
213-
* form `sharing` that keeps a non-empty `publicLink` and sets `enabled ===
214-
* false` or `allowAnonymous === false`. Judged on the body as stored: a switch
215-
* that is absent is not a withdrawal (only an explicit `false` is), and a
216-
* sharing with no public link withdraws nothing — removing the sharing block or
217-
* clearing the link is not a withdrawal. A package artifact parsed by the
218-
* stack schema (strict `defineStack`) carries the schema's default
219-
* `enabled: false`, which is an explicit `false`: a shipped form that keeps its
220-
* link without switching `enabled` on is withdrawn (fail closed). An artifact
221-
* that reached the runtime unparsed (`strict: false`, a hand-built manifest)
222-
* is judged as written, so a switch it omits is absent. The env-wide definition is the
223-
* switch above it, so an env-wide save may still open it.
224-
*/
225-
function anonymousFormExplicitWithdrawals(view: unknown): Array<{ slot: string; slug: string }> {
226-
if (!view || typeof view !== 'object') return [];
227-
const v = view as Record<string, any>;
228-
const forms: Array<{ slot: string; form: unknown }> = [];
229-
if (v.form && typeof v.form === 'object') forms.push({ slot: 'form', form: v.form });
230-
if (v.formViews && typeof v.formViews === 'object') {
231-
for (const [key, fv] of Object.entries(v.formViews)) forms.push({ slot: `formViews:${key}`, form: fv });
232-
}
233-
if (v.viewKind === 'form' && v.config && typeof v.config === 'object') forms.push({ slot: 'config', form: v.config });
234-
const out: Array<{ slot: string; slug: string }> = [];
235-
for (const { slot, form } of forms) {
236-
const sharing = form && typeof form === 'object' ? (form as Record<string, unknown>).sharing : undefined;
237-
if (!sharing || typeof sharing !== 'object') continue;
238-
const s = sharing as Record<string, unknown>;
239-
if (typeof s.publicLink !== 'string' || !s.publicLink) continue;
240-
if (s.enabled !== false && s.allowAnonymous !== false) continue;
241-
out.push({ slot, slug: publicFormSlug(s.publicLink) });
242-
}
243-
return out;
244-
}
245-
246-
/**
247-
* Does one metadata layer withdraw an open form candidate? A WITHDRAWAL IS A
248-
* KILL SWITCH: layering may only narrow anonymous intake, never re-open it, so
249-
* the anonymous form doors serve a candidate only when no layer beneath it
250-
* withdraws it, and the organization-scoped write door refuses a save that
251-
* would leave one open.
252-
*
253-
* Identity is the `name`: the layer withdraws the candidate only through a
254-
* body of the same `name` as the candidate's `view`. What that name is depends
255-
* on the caller. The organization-scoped write door passes the env-wide body
256-
* of the stored row the overlay is keyed by, so a key rename, a `form.name`,
257-
* a slot move or an expansion rename is still judged against the form it was.
258-
* The anonymous doors pass the env-wide view list and the item they serve, so
259-
* they judge by the served item name (a known limit: an overlay stored before
260-
* the withdrawal, or restored by rollback or revert, that moves its form to
261-
* another key or slot is not matched there). The layer withdraws the
262-
* candidate when its body of that name EXPLICITLY
263-
* withdraws a form ({@link anonymousFormExplicitWithdrawals}) that matches the
264-
* candidate by slot (the same `form`, `formViews` key or `config`) OR by slug
265-
* (the same public link, compared exactly as the doors resolve it). Either
266-
* match is enough, so the same form cannot escape a withdrawal by moving to
267-
* another slot or key, or by pointing its link at a new slug; only a form that
268-
* differs from every withdrawn one in both is a different form (a sibling in
269-
* the same container).
270-
*
271-
* Another row that publishes or withdraws the same slug is a different form
272-
* and closes nothing. The package a body is bound to is NOT compared: a
273-
* withdrawal of a name closes that name's form in every package (a known
274-
* limit that fails closed: it may over-close another package's form of the
275-
* same name). It judges only the bodies the layer holds, so a caller closes a
276-
* name in every package only when its layer holds every package's body of the
277-
* name. The organization-scoped write door anchors one body per package. The
278-
* env-wide view list the anonymous doors read holds one item per package of a
279-
* name: a package's saved env-wide copy of a view container serves that
280-
* package's item of each form it expands, and a package-less copy stands in
281-
* for every package with no copy of its own. A layer
282-
* with no body of the row, or whose body has no explicit withdrawal, withdraws
283-
* nothing, so a form published only in an organization stays open there.
284-
*/
285-
export function anonymousFormIntakeWithdrawnIn(
286-
layer: ReadonlyArray<unknown>,
287-
view: unknown,
288-
candidate: AnonymousFormIntakeCandidate,
289-
): boolean {
290-
if (!view || typeof view !== 'object') return false;
291-
const v = view as Record<string, any>;
292-
const name = typeof v.name === 'string' && v.name ? v.name : undefined;
293-
if (name === undefined) return false;
294-
const slot = anonymousFormSlot(v, candidate);
295-
for (const other of layer) {
296-
if (!other || typeof other !== 'object') continue;
297-
if ((other as Record<string, unknown>).name !== name) continue;
298-
for (const w of anonymousFormExplicitWithdrawals(other)) {
299-
if (w.slot === slot || w.slug === candidate.slug) return true;
300-
}
301-
}
302-
return false;
303-
}

‎packages/platform-objects/src/apps/setup-nav.contributions.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ export const SETUP_NAV_CONTRIBUTIONS: NavigationContribution[] = [
180180
// per object (`manageRecycleBin`), and the page lists only the objects
181181
// whose bin the caller manages.
182182
{ id: 'nav_recycle_bin', type: 'component', label: 'Recycle Bin', componentRef: 'data:recycle-bin', icon: 'trash-2' },
183+
// objectstack#36444 — every public form of the environment (a form anyone
184+
// fills in without signing in): switch one on or off, copy its address,
185+
// open it. Operations only; Studio designs the forms. For system
186+
// administrators: the page asks the same capability.
187+
{ id: 'nav_public_forms', type: 'component', label: 'Public Forms', componentRef: 'forms:public-forms', icon: 'file-text', requiredPermissions: ['manage_platform_settings'] },
183188
],
184189
},
185190
{

‎packages/platform-objects/src/apps/translations/ar.source-hashes.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export const arSourceHashes: Readonly<Record<string, string>> = {
118118
'apps.setup.navigation.nav_settings_knowledge.label': '140348539a50d9d5',
119119
'apps.setup.navigation.nav_settings_lifecycle.label': 'cd9fe9c930afed06',
120120
'apps.setup.navigation.nav_recycle_bin.label': '2f5aefe2be221196',
121+
'apps.setup.navigation.nav_public_forms.label': '4592e97959994e86',
121122
'apps.setup.navigation.nav_notification_preferences.label': '8869f324c1bd545a',
122123
'apps.setup.navigation.nav_notification_templates.label': '9e270c87ef2578df',
123124
'apps.setup.navigation.nav_sessions.label': '673bde6e0c8a3ef9',

‎packages/platform-objects/src/apps/translations/ar.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export const ar: TranslationData = {
108108
nav_settings_knowledge: { label: 'المعرفة' },
109109
nav_settings_lifecycle: { label: 'دورة حياة البيانات' },
110110
nav_recycle_bin: { label: 'سلة المحذوفات' },
111+
nav_public_forms: { label: 'النماذج العامة' },
111112
nav_notification_preferences: { label: 'تفضيلات الإشعارات' },
112113
nav_notification_templates: { label: 'قوالب الإشعارات' },
113114

‎packages/platform-objects/src/apps/translations/de.source-hashes.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export const deSourceHashes: Readonly<Record<string, string>> = {
119119
'apps.setup.navigation.nav_settings_knowledge.label': '140348539a50d9d5',
120120
'apps.setup.navigation.nav_settings_lifecycle.label': 'cd9fe9c930afed06',
121121
'apps.setup.navigation.nav_recycle_bin.label': '2f5aefe2be221196',
122+
'apps.setup.navigation.nav_public_forms.label': '4592e97959994e86',
122123
'apps.setup.navigation.nav_notification_preferences.label': '8869f324c1bd545a',
123124
'apps.setup.navigation.nav_notification_templates.label': '9e270c87ef2578df',
124125
'apps.setup.navigation.nav_sessions.label': '673bde6e0c8a3ef9',

‎packages/platform-objects/src/apps/translations/de.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export const de: TranslationData = {
110110
nav_settings_knowledge: { label: 'Wissen' },
111111
nav_settings_lifecycle: { label: 'Datenlebenszyklus' },
112112
nav_recycle_bin: { label: 'Papierkorb' },
113+
nav_public_forms: { label: 'Öffentliche Formulare' },
113114
nav_notification_preferences: { label: 'Benachrichtigungseinstellungen' },
114115
nav_notification_templates: { label: 'Benachrichtigungsvorlagen' },
115116

‎packages/platform-objects/src/apps/translations/en.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export const en: TranslationData = {
144144
nav_settings_knowledge: { label: 'Knowledge' },
145145
nav_settings_lifecycle: { label: 'Data Lifecycle' },
146146
nav_recycle_bin: { label: 'Recycle Bin' },
147+
nav_public_forms: { label: 'Public Forms' },
147148
// Notifications (contributed by @objectstack/service-messaging)
148149
nav_notification_preferences: { label: 'Notification Preferences' },
149150
nav_notification_templates: { label: 'Notification Templates' },

0 commit comments

Comments
 (0)