Include open property on appeals

This commit is contained in:
regalijan 2023-10-20 12:35:51 -04:00
parent a9f04b99d1
commit 4a62ce5c05
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520
4 changed files with 11 additions and 12 deletions

View File

@ -40,6 +40,8 @@ export async function onRequestPost(context: RequestContext) {
delete appeal.fcm_token; delete appeal.fcm_token;
delete appeal.user.email; delete appeal.user.email;
appeal.open = false;
await context.env.DATA.put(`appeal_${appeal.id}`, JSON.stringify(appeal), { await context.env.DATA.put(`appeal_${appeal.id}`, JSON.stringify(appeal), {
expirationTtl: 94608000, expirationTtl: 94608000,
}); });

View File

@ -41,6 +41,12 @@ export async function onRequestPost(context: RequestContext) {
delete appeal.user.email; delete appeal.user.email;
delete appeal.fcm_token; delete appeal.fcm_token;
appeal.open = false;
await context.env.DATA.put(`appeal_${appeal.id}`, JSON.stringify(appeal), {
expirationTtl: 94608000,
});
await fetch(context.env.APPEALS_WEBHOOK, { await fetch(context.env.APPEALS_WEBHOOK, {
body: JSON.stringify({ body: JSON.stringify({
embeds: [ embeds: [

View File

@ -82,6 +82,7 @@ export async function onRequestPost(context: RequestContext) {
fcm_token: typeof senderTokenId === "string" ? senderTokenId : undefined, fcm_token: typeof senderTokenId === "string" ? senderTokenId : undefined,
learned, learned,
id: appealId, id: appealId,
open: true,
reason_for_unban: whyUnban, reason_for_unban: whyUnban,
user: { user: {
email: currentUser.email, email: currentUser.email,

14
index.d.ts vendored
View File

@ -5,28 +5,18 @@ declare global {
ASSETS: Fetcher; ASSETS: Fetcher;
D1: D1Database; D1: D1Database;
DATA: KVNamespace; DATA: KVNamespace;
[k: string]: string; [k: string]: string;
} }
type RequestContext = EventContext<Env, string, { [k: string]: any }>; type RequestContext = EventContext<Env, string, { [k: string]: any }>;
interface EmotionCriticalToChunks {
html: string;
styles: { key: string; ids: string[]; css: string }[];
}
interface EmotionServer {
constructStyleTagsFromChunks: (
criticalData: EmotionCriticalToChunks,
) => string;
extractCriticalToChunks: (html: string) => EmotionCriticalToChunks;
}
interface AppealCardProps { interface AppealCardProps {
ban_reason: string; ban_reason: string;
created_at: number; created_at: number;
id: string; id: string;
learned: string; learned: string;
open?: boolean;
reason_for_unban: string; reason_for_unban: string;
user: { user: {
id: string; id: string;