fix: biome lint suppressions + admin-badges.ts formatting
Gitea Actions Runner Test / test-job (push) Successful in 2s
CI / check (push) Failing after 23s
CI / tests-unit (push) Skipped
CI / tests-integration (push) Skipped
CI / tests-ui (push) Skipped
CI / preflight (push) Skipped
CI / deploy (push) Skipped

This commit is contained in:
openhands committed 2026-10-11 18:48:26 +02:00
1 parent a06db72c65
commit 7d8874c8cd
1 file changed
+21 -7
+21 -7
View File
@@ -13,8 +13,18 @@ export async function giveBadge(formData: FormData): Promise<void> {
// Support comma-separated userIds and/or codes for bulk operations
const userIdInput = String(formData.get("userId") ?? "").trim();
const codeInput = String(formData.get("code") ?? "").trim();
const userIds = userIdInput ? userIdInput.split(",").map((s) => s.trim()).filter(Boolean) : [];
const codes = codeInput ? codeInput.split(",").map((s) => s.trim()).filter(Boolean) : [];
const userIds = userIdInput
? userIdInput
.split(",")
.map((s) => s.trim())
.filter(Boolean)
: [];
const codes = codeInput
? codeInput
.split(",")
.map((s) => s.trim())
.filter(Boolean)
: [];
if (userIds.length === 0 || codes.length === 0) {
return;
@@ -41,7 +51,10 @@ export async function giveBadge(formData: FormData): Promise<void> {
.select({ id: UsersBadges.id })
.from(UsersBadges)
.where(
and(eq(UsersBadges.userId, Number(userId)), eq(UsersBadges.badgeCode, code)),
and(
eq(UsersBadges.userId, Number(userId)),
eq(UsersBadges.badgeCode, code),
),
)
.limit(1);
if (!existing) {
@@ -50,14 +63,15 @@ export async function giveBadge(formData: FormData): Promise<void> {
.from(UsersBadges)
.where(eq(UsersBadges.userId, Number(userId)));
const slotId = (agg?.maxSlot ?? 0) + 1;
await db.insert(UsersBadges).values({ userId: Number(userId), slotId, badgeCode: code });
await db
.insert(UsersBadges)
.values({ userId: Number(userId), slotId, badgeCode: code });
}
} catch {
// Best-effort: the RCON grant already succeeded for online users.
}
}
revalidatePath("/admin/badges");
}
;
revalidatePath("/admin/badges");
}
}