Add player bug reports and profile identity features
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user