Add account restrictions, appeals, and admin moderation tools
This commit is contained in:
@@ -16,7 +16,7 @@ export type MapListing = {
|
||||
bounds: { minX: number; minZ: number; maxX: number; maxZ: number };
|
||||
panorama_count: number;
|
||||
server_id: string;
|
||||
owner_id: string;
|
||||
owner_id: string | null;
|
||||
cover_path: string | null;
|
||||
map_path: string | null;
|
||||
rejection_reason: string | null;
|
||||
@@ -66,7 +66,13 @@ export async function catalog() {
|
||||
.select(
|
||||
"id,display_name,name_glow,glow_color,role,bug_finder,custom_prefix,custom_prefix_icon",
|
||||
)
|
||||
.in("id", [...new Set(maps.map((m) => m.owner_id))]),
|
||||
.in("id", [
|
||||
...new Set(
|
||||
maps
|
||||
.map((m) => m.owner_id)
|
||||
.filter((id): id is string => id !== null),
|
||||
),
|
||||
]),
|
||||
)
|
||||
: [];
|
||||
const signed = await mediaUrls(
|
||||
@@ -74,7 +80,9 @@ export async function catalog() {
|
||||
);
|
||||
return maps.map((m, index) => ({
|
||||
...m,
|
||||
credit: owners.find((p) => p.id === m.owner_id)?.display_name ?? "Explorer",
|
||||
credit:
|
||||
owners.find((p) => p.id === m.owner_id)?.display_name ??
|
||||
(m.owner_id ? "Explorer" : "Deleted player"),
|
||||
creditGlow: owners.find((p) => p.id === m.owner_id)?.name_glow ?? false,
|
||||
creditAppearance: owners.find((p) => p.id === m.owner_id),
|
||||
image: signed[index * 2] ?? undefined,
|
||||
@@ -94,18 +102,22 @@ export async function getMap(id: string) {
|
||||
if (!result.data) return null;
|
||||
const map = result.data as unknown as MapListing;
|
||||
const [owner, signed] = await Promise.all([
|
||||
admin()
|
||||
.from("profiles")
|
||||
.select(
|
||||
"display_name,name_glow,glow_color,role,bug_finder,custom_prefix,custom_prefix_icon",
|
||||
)
|
||||
.eq("id", map.owner_id)
|
||||
.maybeSingle(),
|
||||
map.owner_id
|
||||
? admin()
|
||||
.from("profiles")
|
||||
.select(
|
||||
"display_name,name_glow,glow_color,role,bug_finder,custom_prefix,custom_prefix_icon",
|
||||
)
|
||||
.eq("id", map.owner_id)
|
||||
.maybeSingle()
|
||||
: Promise.resolve({ data: null }),
|
||||
mediaUrls([map.cover_path, map.map_path]),
|
||||
]);
|
||||
return {
|
||||
...map,
|
||||
credit: owner.data?.display_name ?? "Explorer",
|
||||
credit:
|
||||
owner.data?.display_name ??
|
||||
(map.owner_id ? "Explorer" : "Deleted player"),
|
||||
creditGlow: owner.data?.name_glow ?? false,
|
||||
creditAppearance: owner.data ?? undefined,
|
||||
image: signed[0],
|
||||
|
||||
Reference in New Issue
Block a user