Repository navigation
fix(email): point RI-exchange approve/reject links at the SPA deep link - #1444
Conversation
The RI-exchange approval emails linked straight at
/api/ri-exchange/{approve,reject}/:id?token=, which only routes POST, so
clicking a link from the inbox (a GET) returned 401. PR LeanerCloud#1353 added the
confirm-then-POST SPA route at /inventory/ri-exchange/{approve,reject}/:id;
the text and HTML emails now link there.
The "exchange history" links pointed at /#ri-exchange, but the SPA routes
by path, so they opened Home. They now open /inventory/ri-exchange.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): VERDICT: APPROVE Blocking:
Non-blocking:
Attacked:
Body-stale:
Reviewer: rD1. Bar while the maintainers are away (set by IAmJSD as acting owner): one approving independent review on the head, two for money, auth and security paths. |
|
Local verification at |
|
Merged by IAmJSD's agent at IAmJSD's request (IAmJSD is acting owner while the maintainers are away), under the bar IAmJSD set: 1 approving independent review(s) on |
Closes #579
Why
The RI-exchange approval emails linked straight at
/api/ri-exchange/{approve,reject}/:id?token=. Only POST is routed there, so clicking a link from the inbox (a GET) returned 401. PR #1353 added the SPA deep link/inventory/ri-exchange/{approve,reject}/:id?token=(confirm dialog, then POST, with a Playwright spec). The emails still pointed at the API, so users were still hitting the bug.The "exchange history" links in the pending and completed emails pointed at
/#ri-exchange. The SPA routes by path, not by hash, so they opened Home instead of the RI Exchange sub-tab.What
internal/email/templates.go: the plain-text and HTML pending-approval emails now link Approve/Reject to/inventory/ri-exchange/{approve,reject}/{id}?token=.... The three history links (pending text, pending HTML footer, completed text) now go to/inventory/ri-exchange, the page the deep link itself lands on (RI_EXCHANGE_LANDING_PATH). ThePOST /api/ri-exchange/resolve/instruction in the completed email is left alone: it's an API instruction, not a link.internal/email/ri_exchange_links_test.go(new): renders all three emails and checks the exact approve, reject and history URLs, including a token with/+&=to prove it is query-escaped. It also checks that no/api/ri-exchange/{approve,reject}/or/#ri-exchangelink is left.internal/email/template_renderers_test.go: updates the four existing fix(scripts): setup-git-secrets aborts half-configured on a second run #296 URL assertions to the new paths.No backend route changes. The POST API stays as it is (it is what the SPA calls), and no side-effecting GET is added.
internal/server/static.goalready servesindex.htmlfor extensionless paths, so/inventory/ri-exchange/approve/<id>reaches the SPA.Verification
TestRIExchange*Link*tests fail. For example, the text email containsApprove: https://dashboard.example.com/api/ri-exchange/approve/rec-579?token=...andhttps://dashboard.example.com/#ri-exchange.go test -race -short -count=1 ./internal/email/passes, including the 3 new tests and the updated fix(scripts): setup-git-secrets aborts half-configured on a second run #296 tests.go build ./... && go vet ./... && go vet -tags integration ./... && (cd tests/e2e && go vet -tags e2e ./...): pass.golangci-lintv2.10.1 on./internal/email/..., with and without--build-tags integration: 0 issues.gocyclo -over 10 internal/email/templates.go: nothing reported.scripts/test-git-secrets-allowlist.sh: 183 PASS, 0 FAIL.frontend/tests-e2e/riexchange-deeplink.spec.tsandfrontend/src/__tests__/riexchange-deeplink.test.ts. This PR doesn't touch the frontend.🤖 Generated with Claude Code