- Replies stay two levels deep, but a reply to a reply says whom it is
for ("↪ Holdfény"): posts.reply_to_id.
- The question stands apart on its own card; the listening reminder above
the reply box is gone.
- Every rank and badge has its own line icon (Vándor, Kereső, Fonó,
Csillagfonó, Sorsfonó; Moderátor, Meghallgató, Támogató, Szálindító).
- Pages for the new features: own avatar upload and the moderator's reset,
the listener and supporter switches, mention and weekly summary e-mails
(the weekly one off by default), "@" suggestions and mention links, the
daily sky thread by "Sorsfonalak", "Most itt vannak", joining restricted
topics, and the moderators' Témák tab (requests; topics for the admin).
- Members-only topics say so to members too.
- The privacy notice (HU, EN) and point 8.1 of the terms cover own
pictures, badges, mentions, restricted topics and the weekly summary;
the data export and account deletion include them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
125 lines
4.0 KiB
TypeScript
125 lines
4.0 KiB
TypeScript
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<string, string> = {
|
|
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 (
|
|
<div className="fh">
|
|
<h1 className="fpage-title">Moderálás</h1>
|
|
<nav className="fmod-tabs" aria-label="Moderálás">
|
|
<Link href="/forum/moderalas" aria-current={log || topics ? undefined : "page"}>
|
|
Jelentések
|
|
</Link>
|
|
<Link href="/forum/moderalas?nezet=temak" aria-current={topics ? "page" : undefined}>
|
|
Témák
|
|
</Link>
|
|
<Link href="/forum/moderalas?nezet=naplo" aria-current={log ? "page" : undefined}>
|
|
Napló
|
|
</Link>
|
|
</nav>
|
|
{log ? <LogView /> : topics ? <TopicsView /> : <ReportsView />}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
async function ReportsView() {
|
|
const res = await forumGet<{ reports: ReportEntry[] }>("/v1/forum/mod/reports");
|
|
if (!res.ok) notFound();
|
|
return <ReportsList initial={res.data.reports} />;
|
|
}
|
|
|
|
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 (
|
|
<TopicsAdmin
|
|
requests={requests.data.requests}
|
|
topics={list.ok ? list.data.topics : []}
|
|
admin={me?.user.roles.includes("admin") ?? false}
|
|
/>
|
|
);
|
|
}
|
|
|
|
async function LogView() {
|
|
const res = await forumGet<{ entries: ModLogEntry[] }>("/v1/forum/mod/log");
|
|
if (!res.ok) notFound();
|
|
if (res.data.entries.length === 0) return <p className="fh-card fh-empty">Még nem volt moderálás.</p>;
|
|
return (
|
|
<ul className="fh-card fh-flush fmodlog">
|
|
{res.data.entries.map((e) => (
|
|
<li key={e.id}>
|
|
<span className="hint">
|
|
{new Date(e.created_at).toLocaleString("hu-HU", { timeZone: "Europe/Budapest" })}
|
|
{e.actor_kind === "ai" && " · AI"}
|
|
</span>
|
|
<span>
|
|
<strong>{e.actor ?? "?"}</strong> {ACTIONS[e.action] ?? e.action}
|
|
{e.target && (
|
|
<>
|
|
{" "}
|
|
(<Link href={memberHref(e.target)}>{e.target}</Link>)
|
|
</>
|
|
)}
|
|
{e.thread && (
|
|
<>
|
|
{": "}
|
|
<Link href={threadHref({ id: e.thread.id, slug: "" }, e.post_id ?? undefined)}>
|
|
{e.thread.title ?? `#${e.thread.id}`}
|
|
</Link>
|
|
</>
|
|
)}
|
|
{e.until && ` · ${banText(e.until)}`}
|
|
</span>
|
|
{e.reason && <span className="hint">Ok: {e.reason}</span>}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
);
|
|
}
|