Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Include open property on appeals
  • Loading branch information
regalijan committed Oct 20, 2023
1 parent a9f04b9 commit 4a62ce5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 2 additions & 0 deletions functions/api/appeals/[id]/accept.ts
Expand Up @@ -40,6 +40,8 @@ export async function onRequestPost(context: RequestContext) {
delete appeal.fcm_token;
delete appeal.user.email;

appeal.open = false;

await context.env.DATA.put(`appeal_${appeal.id}`, JSON.stringify(appeal), {
expirationTtl: 94608000,
});
Expand Down
6 changes: 6 additions & 0 deletions functions/api/appeals/[id]/deny.ts
Expand Up @@ -41,6 +41,12 @@ export async function onRequestPost(context: RequestContext) {
delete appeal.user.email;
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, {
body: JSON.stringify({
embeds: [
Expand Down
1 change: 1 addition & 0 deletions functions/api/appeals/submit.ts
Expand Up @@ -82,6 +82,7 @@ export async function onRequestPost(context: RequestContext) {
fcm_token: typeof senderTokenId === "string" ? senderTokenId : undefined,
learned,
id: appealId,
open: true,
reason_for_unban: whyUnban,
user: {
email: currentUser.email,
Expand Down
14 changes: 2 additions & 12 deletions index.d.ts
Expand Up @@ -5,28 +5,18 @@ declare global {
ASSETS: Fetcher;
D1: D1Database;
DATA: KVNamespace;

[k: string]: string;
}

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 {
ban_reason: string;
created_at: number;
id: string;
learned: string;
open?: boolean;
reason_for_unban: string;
user: {
id: string;
Expand Down

0 comments on commit 4a62ce5

Please sign in to comment.