Move appeal bans entirely to D1

This commit is contained in:
2023-10-19 16:50:41 -04:00
parent 736543c374
commit eb550a7c36
2 changed files with 14 additions and 6 deletions

View File

@ -52,7 +52,13 @@ export async function onRequestPost(context: RequestContext) {
status: 403,
});
if (await context.env.DATA.get(`appealban_${currentUser.id}`)) {
if (
(
await context.env.D1.prepare("SELECT * FROM appeal_bans WHERE user = ?;")
.bind(currentUser.id)
.run()
).results.length
) {
await context.env.DATA.put(`blockedappeal_${currentUser.id}`, "1", {
metadata: { email: currentUser.email },
});