Repository navigation
Conversation
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks @joei4cm, this is a great fix. Pulling the lookup into There are two things I'd like to ask for before we merge. The first is the format check, which is what's failing CI. It checks every file a PR touches, and The second is new now that saved templates reach real inboxes. An admin can save an invitation template that no longer contains Thanks as well for offering to rebase around #280. Whichever one lands second will need it, since both touch the same strings in |
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
Thanks @joei4cm, both of those look great. The accept-link check is exactly what I was after, and it's nice to see the invite routes formatted too. Reading through it again, there are three things I'd like to ask for before we merge. The first is invite templates that were saved before this change. The new check runs on save, so an invite override already in the database never went through it. Once this merges, those rows start going out in real emails. If one is missing The second is the check itself. The third is in |
Rows saved before the PUT check existed never went through it, so an
invite override can still lack {{invite.url}} — and sending it mails the
invitee an email they cannot accept while the route reports success. The
send path now treats such an override as absent, falling back to the
on-disk template and logging a warning; the editor and preview still
read the stored row so an admin can fix it.
The required-link check also moves to a shared pattern: interpolate
trims whitespace inside the braces, so {{ invite.url }} renders a
working link and the save check must accept it. The spaced spelling now
saves, and the send-side fallback uses the same pattern.
Co-Authored-By: Claude Code <noreply@anthropic.com>
|
All three addressed in a516c69:
Validation: team-api + templates-api 77/77, full apps/web suite 1221 passed / 26 skipped, typecheck, next lint (0 errors), Prettier, |
|
Thanks @joei4cm, this is great. Falling back to the on-disk template when a saved invite has no accept link is exactly what I was hoping for. Keeping the editor and preview on the stored row is a nice touch too, since it means an admin can still see the problem and fix it. Sharing one pattern between the save check and the send path means the two can't drift apart, and the spaced-spelling test pins that down. The test updates are really solid as well. Clearing the mock between passes and asserting the accept URL in the delivered email make that loop prove what it claims. This is ready from my side. We'll merge once CI has run. Thanks again for sticking with it through a few rounds. |
Refs #279.
Saved template overrides now reach outgoing invitation email.
POST /api/team/inviteandPOST /api/team/invite/resendpass the stored-override lookup intosendEmail, so a savedinviteoverride controls the subject and body, and removing it falls back to the packaged template.The lookup is shared with the template GET and preview routes through
apps/web/src/lib/template-override.ts, so the editor, preview, and delivery path read the same row. The templates screen now distinguishes theinvitetemplate, which is used for outgoing invitations, from the other preview-only templates.Invite previews now use the same context shape the invite routes send, so variables that invitation emails cannot fill render empty in preview instead of showing unrelated sample data. Template subject saves also reject control characters because the subject becomes an email header.
Regression coverage exercises both invite paths with a saved override and after the override is removed, using the real
sendEmailrenderer with a fake transport. Preview coverage checks the invite context and the new subject validation.Validation:
cd apps/web && NODE_OPTIONS='--max-old-space-size=4096' pnpm --config.concurrency=2 exec vitest run src/__tests__/team-api.test.ts src/__tests__/templates-page.test.tsx src/__tests__/templates-api.test.ts --maxWorkers=2— 3 files, 86 tests passed.Note: #280 covers the remaining copy and dead-issue-reference cleanup from #279; this PR is the send-path fix. Happy to rebase if #280 lands first.
🤖 Generated with Claude Code