feat(website): ask before setting up the company on a register link - #38
Conversation
A register confirm link now carries the parked company name, so /welcome shows it back to the reader before anything is created. "Yes, set it up" claims with expected_name, so a link naming a company that is no longer parked is refused (400) with plain copy and a way on to the password rather than a silent claim of something else. "No, that's not my company" discards the parked marker, mints nothing, and says they can register their own company from the app later. Older mails still in flight carry flow=register with no name; those keep the zero-argument claim and skip the consent card entirely. Nothing fires on mount or in an effect — both RPCs are tap-driven, the fragment is still read once, and the company name is React text.
…egister link shape
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9b59735bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Authorization: `Bearer ${phase.accessToken}`, | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: "{}", |
There was a problem hiding this comment.
Bind the discard to the company shown
When a previously issued link remains valid after the parked company changes—the stale-link case already handled by expected_name on the claim path—the consent card shows the old company, but choosing “No” sends an unqualified discard. The RPC therefore cannot distinguish the rejected company from the newer parked one and can clear the user's current registration, causing its confirmation link to fail as stale too. Pass the displayed company to the discard RPC and clear the marker only when it still matches.
Useful? React with 👍 / 👎.
Summary
WorkLog website half of jobsight-backend #35 stage A: ask before claiming a company.
Register confirm links now carry the company name (
…&flow=register&company=<name>, fromworklog-register-companyonce jobsight-backend's stage-A PR deploys). After the tap-driven confirm,/welcomeshows the name as text and asks:claim_pending_company({ expected_name }). The server refuses any other name (400 → "This link is out of date for that company…", skip-to-password kept, no retry).discard_pending_company(clears the parked name, mints nothing) → password form. The final card then says the password is saved and the company can be registered from the app later, never "your company is ready".Nothing fires on mount or in an effect; no server text is rendered; the name is a JSX text child only. Site classes only.
Order
Deploy after jobsight-backend's stage-A PR (migration
20260909000201+ both register functions). Until then no link carriescompanyand this page behaves as today. Worklog-site is not GitHub-linked on Vercel: deploy withvercel deploy --prodfromwebsite/.Verification
npm run typecheck,npm test(42),npm run build— green. WorkLog CI runs nothing onwebsite/**.ecc:code-revieweron Opus — the repo'sworklog-revieweris not registered in this session; Reviewer B Gemini), both PASS in round 2. Round-1 HIGH: the done card promised a company to a reader who declined; fixed and pinned inwelcome-copy.test.ts. Round-2 MEDIUM (skip after a failed decline) fixed in the third commit.