Add live account appeal updates and restricted status settings

This commit is contained in:
2026-10-13 14:22:12 +05:00
parent cfe5820802
commit 8c3de302e7
21 changed files with 508 additions and 52 deletions

View File

@@ -21,7 +21,7 @@ export async function accountProfile(account: User) {
await admin()
.from("profiles")
.select(
"id,display_name,role,name_glow,glow_color,bug_finder,custom_prefix,custom_prefix_icon",
"id,display_name,role,name_glow,glow_color,bug_finder,custom_prefix,custom_prefix_icon,account_status,account_reason,account_changed_at",
)
.eq("id", account.id)
.single(),

34
lib/realtime-refresh.ts Normal file
View File

@@ -0,0 +1,34 @@
/** Serialize refreshes, retaining one follow-up if a change arrives mid-request. */
export function realtimeRefresh(
refresh: () => Promise<void>,
onError: (error: unknown) => void,
) {
let running = false;
let pending = false;
let closed = false;
async function request() {
if (closed) return;
pending = true;
if (running) return;
running = true;
try {
while (pending && !closed) {
pending = false;
try {
await refresh();
} catch (error) {
if (!closed) onError(error);
}
}
} finally {
running = false;
}
}
return {
request,
close: () => {
closed = true;
pending = false;
},
};
}