feat(admin): ban appeals, photos polish, economy adjust, staff smoke
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m17s
CI / check (push) Successful in 25s
CI / deploy (push) Failing after 11s

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-30 20:23:03 +02:00
1 parent fe46bd0544
commit 3ad3f9512c
36 files changed
+1185 -293

No files matched your search

+50 -1
View File
@@ -99,12 +99,61 @@ export async function createTicket(formData: FormData): Promise<void> {
}
if (!moderated) {
const banAppeal =
String(formData.get("banAppeal") ?? "") === "1" ||
String(formData.get("banAppeal") ?? "") === "on";
let ticketTitle = title;
let categoryId: bigint | null = null;
if (banAppeal) {
if (!/ban\s*appeal/i.test(ticketTitle)) {
ticketTitle = `[Ban appeal] ${ticketTitle}`.slice(0, 255);
}
const existing = await prisma.websiteHelpCenterCategories.findFirst(
{
where: { name: { equals: "Ban appeal" } },
select: { id: true },
},
);
if (existing) {
categoryId = existing.id;
} else {
try {
const created = await prisma.websiteHelpCenterCategories.create(
{
data: {
name: "Ban appeal",
content:
"Appeals for account bans. Staff can lift bans from the ticket.",
position: 0,
},
select: { id: true },
},
);
categoryId = created.id;
} catch {
const again =
await prisma.websiteHelpCenterCategories.findFirst({
where: { name: { equals: "Ban appeal" } },
select: { id: true },
});
categoryId = again?.id ?? null;
}
}
} else {
const rawCat = String(formData.get("categoryId") ?? "").trim();
if (/^\d+$/.test(rawCat)) {
categoryId = BigInt(rawCat);
}
}
const now = new Date();
await prisma.websiteHelpCenterTickets.create({
data: {
userId,
title,
title: ticketTitle,
content,
categoryId,
open: true,
createdAt: now,
updatedAt: now,