feat(intake): require an address for an upload link and send the link to it (#260)

Creating a link now requires a valid email address and mails the link to it, which is the whole point: getting a link to a contributor was previously a copy-and-paste into whatever the admin happened to use.

The send is awaited and its outcome reported, unlike every other sender in this codebase, which fires and forgets because nobody is waiting on the answer. Here somebody is. The admin is looking at the screen, and whether they now have to send the link by hand is exactly the thing they need to know — and QA blocks delivery to any address outside MAIL_ALLOWLIST by design, so a link that was never emailed would otherwise look precisely like one that was.

A send that could not happen does not roll the link back. The token is displayed exactly once, so a rollback would leave the admin retrying and holding a different link, discarding work that had succeeded. They end up with a usable link and an honest statement about delivery instead.

One inaccuracy left deliberately: an SMTP rejection is reported as skipped-unconfigured rather than a fourth outcome of its own. The distinction is real but nothing consumes it, and the admin's next action is identical either way.

Also updates the other integration tests that created a link with only a label, since an address is now required, and adds the uploadLink template key that GET /api/admin/email-templates was missing from its list — an omission left by the template's addition in the prior commit on this branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-03 18:00:15 -05:00
co-authored by Claude Opus 5
parent eaecc43379
commit b18b3e3a3d
5 changed files with 175 additions and 16 deletions
@@ -20,7 +20,9 @@ afterAll(async () => {
});
async function makeLink(): Promise<string> {
const res = await request(app).post('/api/admin/upload-links').send({ label: 'ceiling spec' });
const res = await request(app)
.post('/api/admin/upload-links')
.send({ label: 'ceiling spec', email: 'sarah@example.com' });
expect(res.status).toBe(201);
return res.body.token;
}