import Link from "next/link"; import { notFound } from "next/navigation"; import { type ForumTopic, type ModLogEntry, type ReportEntry, type TopicRequest, banText, memberHref, threadHref, } from "@/lib/forum"; import { forumGet } from "@/lib/forumServer"; import { getMe } from "@/lib/server"; import { ReportsList } from "./ReportsList"; import { TopicsAdmin } from "./TopicsAdmin"; export const metadata = { title: "Moderálás", robots: { index: false } }; const ACTIONS: Record = { delete_post: "hozzászólást távolított el", restore_post: "hozzászólást állított vissza", delete_thread: "szálat távolított el", restore_thread: "szálat állított vissza", ban: "eltiltotta", unban: "feloldotta az eltiltását", lock: "lezárta a szálat", unlock: "feloldotta a szálat", pin: "kitűzte a szálat", unpin: "levette a kitűzést", resolve_report: "lezárt egy jelentést", dismiss_report: "alaptalannak ítélt egy jelentést", approve_member: "felvette egy zárt témába", reject_member: "elutasította a jelentkezését", remove_member: "eltávolította egy zárt témából", reset_avatar: "eltávolította a saját képét", topic: "témát kezelt", }; type Props = { searchParams: Promise<{ nezet?: string }> }; /** Moderators: the open reports, and the log of every moderation step. */ export default async function ModerationPage({ searchParams }: Props) { const view = (await searchParams).nezet; const log = view === "naplo"; const topics = view === "temak"; return (

Moderálás

{log ? : topics ? : }
); } async function ReportsView() { const res = await forumGet<{ reports: ReportEntry[] }>("/v1/forum/mod/reports"); if (!res.ok) notFound(); return ; } async function TopicsView() { const [requests, list, me] = await Promise.all([ forumGet<{ requests: TopicRequest[] }>("/v1/forum/mod/topic-requests"), forumGet<{ topics: ForumTopic[] }>("/v1/forum/topics"), getMe(), ]); if (!requests.ok) notFound(); return ( ); } async function LogView() { const res = await forumGet<{ entries: ModLogEntry[] }>("/v1/forum/mod/log"); if (!res.ok) notFound(); if (res.data.entries.length === 0) return

Még nem volt moderálás.

; return (
    {res.data.entries.map((e) => (
  • {new Date(e.created_at).toLocaleString("hu-HU", { timeZone: "Europe/Budapest" })} {e.actor_kind === "ai" && " · AI"} {e.actor ?? "?"} {ACTIONS[e.action] ?? e.action} {e.target && ( <> {" "} ({e.target}) )} {e.thread && ( <> {": "} {e.thread.title ?? `#${e.thread.id}`} )} {e.until && ` · ${banText(e.until)}`} {e.reason && Ok: {e.reason}}
  • ))}
); }