Add player bug reports and profile identity features

This commit is contained in:
2026-10-08 18:27:20 +05:00
parent 36e8d11eb4
commit 0b08672f4a
51 changed files with 3938 additions and 45 deletions

View File

@@ -70,13 +70,27 @@ export async function accountApi(
});
if (request.method === "PATCH") {
const body = profileUpdateSchema.parse(await context.jsonBody(request));
await accountProfile(account);
const current = await accountProfile(account);
if (body.glowColor !== undefined && !current.name_glow)
return json(
{ error: "Earn a username glow before choosing its color" },
403,
);
const profile = required(
await admin()
.from("profiles")
.update({ display_name: body.displayName })
.update({
...(body.displayName !== undefined
? { display_name: body.displayName }
: {}),
...(body.glowColor !== undefined
? { glow_color: body.glowColor }
: {}),
})
.eq("id", account.id)
.select("id,display_name,role")
.select(
"id,display_name,role,name_glow,glow_color,bug_finder,custom_prefix,custom_prefix_icon",
)
.single(),
);
return json({ profile });