Delete FCM token from KV on report action
This commit is contained in:
parent
53b05e2bdd
commit
b054d4cf41
@ -43,10 +43,6 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reportData.open = false;
|
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)
|
if (user?.email && !reportData.fcm_token)
|
||||||
await sendEmail(
|
await sendEmail(
|
||||||
@ -65,6 +61,15 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
`Your report for ${reportData.target_usernames.toString()} has been reviewed.`,
|
`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, {
|
return new Response(null, {
|
||||||
status: 204,
|
status: 204,
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user