Forum: a service of its own and the /forum pages

services/forum (axum, port 8083) on the same database and login, in the
forum schema (migration 0038, which also adds the moderator role):
nicknames, profiles with shared signs, topics, threads with listening or
advice intent, two-level replies, read marks and followed threads,
reactions as ratings with points and ranks, newcomer limits (lifted by a
purchase), moderation with reasons, bans and a log. Integration tests run
in CI.

The frontend's /forum pages (light by default, dark on request, phone
first with a desktop layout) are switched on by FORUM_URL; the /api/v1
proxy sends /api/v1/forum/* to the forum service. Concept and status:
docs/kozosseg.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-26 10:29:49 +00:00
co-authored by Claude Opus 5.5
parent fa46dcb757
commit 36b38525c3
52 changed files with 6782 additions and 11 deletions
@@ -0,0 +1,64 @@
import Link from "next/link";
import { notFound } from "next/navigation";
import { type ModLogEntry, banText, memberHref, threadHref } from "@/lib/forum";
import { forumGet } from "@/lib/forumServer";
export const metadata = { title: "Moderálási napló", 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",
};
/** Every moderation step: who, what, why (moderators only). */
export default async function ModLogPage() {
const res = await forumGet<{ entries: ModLogEntry[] }>("/v1/forum/mod/log");
if (!res.ok) notFound();
return (
<div className="fh">
<h1 className="fpage-title">Moderálási napló</h1>
{res.data.entries.length === 0 ? (
<p className="fh-card fh-empty">Még nem volt moderálás.</p>
) : (
<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>
)}
</div>
);
}