From 53b05e2bdda6d07b0e79e1c7f3fb155ce703dc7b Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:51:20 -0400 Subject: [PATCH] Delete FCM token from KV on appeal action --- functions/api/appeals/[id]/accept.ts | 1 + functions/api/appeals/[id]/deny.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/functions/api/appeals/[id]/accept.ts b/functions/api/appeals/[id]/accept.ts index 2c5a53b..156717d 100644 --- a/functions/api/appeals/[id]/accept.ts +++ b/functions/api/appeals/[id]/accept.ts @@ -37,6 +37,7 @@ export async function onRequestPost(context: RequestContext) { .bind(context.params.id) .run(); + delete appeal.fcm_token; delete appeal.user.email; await context.env.DATA.put(`appeal_${appeal.id}`, JSON.stringify(appeal), { diff --git a/functions/api/appeals/[id]/deny.ts b/functions/api/appeals/[id]/deny.ts index 71b99cb..ebdb361 100644 --- a/functions/api/appeals/[id]/deny.ts +++ b/functions/api/appeals/[id]/deny.ts @@ -38,6 +38,9 @@ export async function onRequestPost(context: RequestContext) { const { current_user: currentUser } = context.data; + delete appeal.user.email; + delete appeal.fcm_token; + await fetch(context.env.APPEALS_WEBHOOK, { body: JSON.stringify({ embeds: [