diff --git a/functions/api/reports/[id]/action.ts b/functions/api/reports/[id]/action.ts index e061265..b4ed1f9 100644 --- a/functions/api/reports/[id]/action.ts +++ b/functions/api/reports/[id]/action.ts @@ -43,10 +43,6 @@ export async function onRequestPost(context: RequestContext) { } reportData.open = false; - await context.env.DATA.put(`report_${reportId}`, JSON.stringify(reportData)); - await context.env.D1.prepare("UPDATE reports SET open = 0 WHERE id = ?;") - .bind(reportId) - .run(); if (user?.email && !reportData.fcm_token) await sendEmail( @@ -65,6 +61,15 @@ export async function onRequestPost(context: RequestContext) { `Your report for ${reportData.target_usernames.toString()} has been reviewed.`, ); + delete reportData.fcm_token; + delete (reportData.user as { email?: string; id: string; username: string }) + ?.email; + + await context.env.DATA.put(`report_${reportId}`, JSON.stringify(reportData)); + await context.env.D1.prepare("UPDATE reports SET open = 0 WHERE id = ?;") + .bind(reportId) + .run(); + return new Response(null, { status: 204, });