Public Access
fix(feedback): read the live route's Free/free seat-count keys
GET /webhook/feedback answers {"free":"","Free":9} (200), but the page
only read seats_left/seatsLeft, so the live page rendered state 4 ("We
cannot read the seat count right now."). Add the wire's own names after the
documented ones: leftKeys: [seats_left, seatsLeft, Free, free]. The existing
guard already skips "free": "" and requires a whole number >= 0, so 9 is
used and an empty string alone prints no number. Document the expected GET
reply (free/Free + the optional feedback[] shape and its publish gate) in the
constants comment. No total is returned, so "9 seats left" stays. Four
states, consent gate, claim body, leak rules and copy untouched.
This commit is contained in:
1 parent
5d2dc11fbc
commit
28d95b4dcd
1 file changed
+13
-2
+13
-2
@@ -164,8 +164,17 @@
|
||||
the feedback form. SHAPES (this is the contract to match in the n8n workflow):
|
||||
|
||||
GET statusUrl (no query string)
|
||||
-> 200 { "seats_left": 7, "seats_total": 10,
|
||||
-> 200 { "seats_left": 7, "seats_total": 10 } <- the intended shape
|
||||
or { "free": 9 } <- what the live route answers today
|
||||
or { "free": 0,
|
||||
"feedback": [ { "text": "...", "name": "Jane", "publish": "yes" } ] }
|
||||
A count arrives under the documented names first, then the live route's
|
||||
"Free"/"free"; a count must be a whole number >= 0 or it is not on the wire
|
||||
(so "free": "" is skipped and the next key is read). "feedback" (aka "entries")
|
||||
carries the cohort's words: each entry is published only when its "publish" is
|
||||
"yes" (words with the name) or "name" (words without it) — "no", missing or
|
||||
unknown is never rendered. With no seats and no "feedback", the cohort-full
|
||||
state states plainly that nothing is published yet (never a blank list).
|
||||
|
||||
POST submitUrl { "form": "claim", "upwork": "<their Upwork name>" }
|
||||
-> 200 { "seats_left": 6, "seats_total": 10, "held_until": "2026-11-03T18:40:00Z" }
|
||||
@@ -184,7 +193,9 @@
|
||||
// The one route that receives a claim and the feedback form.
|
||||
submitUrl: "https://n8n.odoo4projects.com/webhook/feedback",
|
||||
// GET reply keys, in the order they are read. A key not listed here is never read.
|
||||
leftKeys: ["seats_left", "seatsLeft"],
|
||||
// "Free"/"free" are the live route's names today; they come last so the documented
|
||||
// shape still wins if it ever arrives. "free": "" is skipped by pick() below.
|
||||
leftKeys: ["seats_left", "seatsLeft", "Free", "free"],
|
||||
totalKeys: ["seats_total", "seatsTotal"],
|
||||
feedbackKeys: ["feedback", "entries"],
|
||||
// One feedback entry. A missing "" means "not on the wire", never a value.
|
||||
|
||||
Reference in new issue
Block a user