Accept multiple types of appeals
This commit is contained in:
@ -84,6 +84,10 @@ export default function (props: GameAppealProps & { port?: MessagePort }) {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<Stack divider={<StackDivider />}>
|
<Stack divider={<StackDivider />}>
|
||||||
|
<Box>
|
||||||
|
<Heading size="xs">Appeal Type</Heading>
|
||||||
|
<Text>{props.type}</Text>
|
||||||
|
</Box>
|
||||||
<Box>
|
<Box>
|
||||||
<Heading size="xs">Response: Explanation of Ban</Heading>
|
<Heading size="xs">Response: Explanation of Ban</Heading>
|
||||||
<Text>{props.what_happened}</Text>
|
<Text>{props.what_happened}</Text>
|
||||||
|
@ -16,29 +16,49 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
if (!appeal) return jsonError("Appeal not found", 400);
|
if (!appeal) return jsonError("Appeal not found", 400);
|
||||||
|
|
||||||
const banList = (await getBanList(context)) as {
|
const banList = (await getBanList(context)) as {
|
||||||
[k: string]: { BanType: number; Unbanned?: boolean; UnbanReduct?: number };
|
[k: string]: {
|
||||||
|
BanType: number;
|
||||||
|
hidden_from_leaderboards?: boolean;
|
||||||
|
serverconfigurator_blacklist?: boolean;
|
||||||
|
Unbanned?: boolean;
|
||||||
|
UnbanReduct?: number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
await context.env.D1.prepare("DELETE FROM game_appeals WHERE id = ?;")
|
await context.env.D1.prepare("DELETE FROM game_appeals WHERE id = ?;")
|
||||||
.bind(context.params.id)
|
.bind(context.params.id)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
if (!banList[appeal.roblox_id])
|
if (!banList[appeal.roblox_id]?.BanType)
|
||||||
return new Response(null, {
|
return new Response(null, {
|
||||||
status: 204,
|
status: 204,
|
||||||
});
|
});
|
||||||
|
|
||||||
banList[appeal.roblox_id] = {
|
if (banList[appeal.roblox_id].BanType === 2) {
|
||||||
BanType: 0,
|
banList[appeal.roblox_id] = {
|
||||||
Unbanned: true,
|
BanType: 0,
|
||||||
UnbanReduct: statsReduction,
|
Unbanned: true,
|
||||||
};
|
UnbanReduct: statsReduction,
|
||||||
|
};
|
||||||
|
} else if (appeal.type === "server configurator") {
|
||||||
|
banList[appeal.roblox_id] = {
|
||||||
|
...banList[appeal.roblox_id],
|
||||||
|
serverconfigurator_blacklist: false,
|
||||||
|
};
|
||||||
|
} else if (appeal.type === "blacklist") {
|
||||||
|
banList[appeal.roblox_id] = {
|
||||||
|
...banList[appeal.roblox_id],
|
||||||
|
hidden_from_leaderboards: false,
|
||||||
|
Unbanned: true,
|
||||||
|
UnbanReduct: statsReduction,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
await context.env.D1.prepare(
|
await context.env.D1.prepare(
|
||||||
"INSERT INTO game_mod_logs (action, evidence, executed_at, executor, id, target) VALUES (?, ?, ?, ?, ?, ?);",
|
"INSERT INTO game_mod_logs (action, evidence, executed_at, executor, id, target) VALUES (?, ?, ?, ?, ?, ?);",
|
||||||
)
|
)
|
||||||
.bind(
|
.bind(
|
||||||
"accept_appeal",
|
`accept appeal | ${banList[appeal.roblox_id]?.BanType === 2 ? "ban" : appeal.type}`,
|
||||||
`https://carcrushers.cc/mod-queue?id=${context.params.id}&type=gma`,
|
`https://carcrushers.cc/mod-queue?id=${context.params.id}&type=gma`,
|
||||||
Date.now(),
|
Date.now(),
|
||||||
context.data.current_user.id,
|
context.data.current_user.id,
|
||||||
|
3
index.d.ts
vendored
3
index.d.ts
vendored
@ -15,7 +15,7 @@ declare global {
|
|||||||
event_id: string;
|
event_id: string;
|
||||||
event_type: string;
|
event_type: string;
|
||||||
token: string;
|
token: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
type RequestContext = EventContext<Env, string, { [k: string]: any }>;
|
type RequestContext = EventContext<Env, string, { [k: string]: any }>;
|
||||||
|
|
||||||
@ -39,6 +39,7 @@ declare global {
|
|||||||
reason_for_unban: string;
|
reason_for_unban: string;
|
||||||
roblox_id: number;
|
roblox_id: number;
|
||||||
roblox_username: string;
|
roblox_username: string;
|
||||||
|
type: string;
|
||||||
what_happened: string;
|
what_happened: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user