Don't rely on metadata for appeals
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
const { permissions } = context.data.current_user;
|
||||
|
||||
if (!(permissions & (1 << 0)) || !(permissions & (1 << 11)))
|
||||
if (!(permissions & (1 << 0)) && !(permissions & (1 << 11)))
|
||||
return new Response('{"error":"Forbidden"}', {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
@ -15,9 +15,9 @@ export async function onRequestPost(context: RequestContext) {
|
||||
context.data.targetId = id;
|
||||
|
||||
if (!new URL(context.request.url).pathname.endsWith("/ban")) {
|
||||
const keyWithMeta = await context.env.DATA.getWithMetadata(`appeal_${id}`);
|
||||
const key = await context.env.DATA.get(`appeal_${id}`);
|
||||
|
||||
if (!keyWithMeta.value)
|
||||
if (!key)
|
||||
return new Response('{"error":"No appeal with that ID exists"}', {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
@ -25,7 +25,7 @@ export async function onRequestPost(context: RequestContext) {
|
||||
status: 404,
|
||||
});
|
||||
|
||||
context.data.appeal = keyWithMeta;
|
||||
context.data.appeal = key;
|
||||
}
|
||||
|
||||
if (
|
||||
|
Reference in New Issue
Block a user