Commit 768331d
fix(rest): resolve public forms from flattened view metadata (#1989)
`findPublicFormView` (the /forms/:slug + /forms/:slug/submit resolver) only
matched the *authoring* view shape — `view.form.sharing` and
`view.formViews.{key}.sharing`. But `getMetaItems({type:'view'})` returns the
*registered* shape: one flattened item per view, `{ name, object, viewKind,
config: { data, sections, sharing } }`. The form's `sharing` (allowAnonymous +
publicLink) lives under `config`, which the resolver never inspected — so every
standard public form silently failed with FORM_NOT_FOUND, making Web-to-Lead /
Web-to-Case non-functional despite being fully declared.
Add a third candidate source: a `viewKind === 'form'` item whose `config` carries
`sharing`. Object name resolves via `config.data.object` / the item's `object`.
Verified end-to-end (HotCRM): anonymous GET /api/v1/forms/contact-us → 200 form
spec; POST /api/v1/forms/contact-us/submit (no auth) → creates a crm_lead;
/forms/support → crm_case; guest reads still 401 (INSERT-only enforced).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 07f93e3 commit 768331d
1 file changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3448 | 3448 | | |
3449 | 3449 | | |
3450 | 3450 | | |
| 3451 | + | |
3451 | 3452 | | |
3452 | 3453 | | |
3453 | 3454 | | |
| |||
3457 | 3458 | | |
3458 | 3459 | | |
3459 | 3460 | | |
| 3461 | + | |
| 3462 | + | |
| 3463 | + | |
| 3464 | + | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
3460 | 3469 | | |
3461 | 3470 | | |
3462 | 3471 | | |
| |||
0 commit comments