Skip to content

Commit 4f2ffd6

Browse files
ralyodioclaude
andcommitted
fix: send PDF email for signed-in project scans
The audits table has a pdf_email column the worker reads to decide whether to render the PDF + Resend it after a scan finishes. The anonymous hero form populated it from the form field; the signed-in project scan path (runScanForProject) silently inserted audits with pdf_email=null, so the worker never sent the report. Default pdf_email to the user's account email — matches the expectation that a signed-in scan emails the result to the logged-in user. Also passes it through notifyWorker so the in-flight HTTP enqueue carries the email, not just the DB row. Confirmed via DB inspection: recent project-page scans show pdf_email=null while old hero-form scans show the email populated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 752ad87 commit 4f2ffd6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎app/actions/runAudit.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ export async function runScanForProject(input: {
209209
}
210210

211211
const svc = serviceClient();
212+
// Default the PDF-receipt email to the signed-in user's address. The hero
213+
// form takes an explicit email; the project page doesn't ask, so we use
214+
// the account email — matches the user's expectation of "I'll get the
215+
// report emailed to me."
216+
const pdfEmail = user.email ?? null;
212217
const inserts = engines.map((e) => ({
213218
target_url: target,
214219
project_id: input.projectId,
@@ -217,6 +222,7 @@ export async function runScanForProject(input: {
217222
share_token: newShareToken(),
218223
triggered_by: "manual",
219224
engine: e,
225+
pdf_email: pdfEmail,
220226
}));
221227
const { data: rows, error } = await svc
222228
.from("audits")
@@ -242,7 +248,7 @@ export async function runScanForProject(input: {
242248
}),
243249
),
244250
);
245-
for (const r of rows) await notifyWorker(r.id);
251+
for (const r of rows) await notifyWorker(r.id, pdfEmail ?? undefined);
246252

247253
// Suppress unused-warning on paidEngines (it's documentation for now).
248254
void paidEngines;

0 commit comments

Comments
 (0)