Forum: reports for moderators and private messages by request

Any logged-in user can report a post, or a private message received; a
possible crisis shows the helplines at once. Moderators get the open
reports (crisis first) with what was reported, remove or close them, and
every step goes to the log; the operator gets a Telegram notice of each
new report (kind and link only). Private conversations start with a
request and a short introduction (from the Kereső rank, a few a day); the
recipient accepts, declines silently or blocks.

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:48:28 +00:00
co-authored by Claude Opus 5.5
parent 36b38525c3
commit 4def9569b1
28 changed files with 2322 additions and 58 deletions
+89
View File
@@ -142,6 +142,7 @@ export interface ForumMe {
export interface MemberProfile {
viewer: ForumViewer;
relation: MemberRelation | null;
member: {
author: ForumAuthor;
bio: string;
@@ -257,3 +258,91 @@ export function banText(until: string | null): string {
if (until === "infinity") return "véglegesen";
return `eddig: ${new Date(until).toLocaleString("hu-HU", { timeZone: "Europe/Budapest", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" })}`;
}
/** The viewer's relation to a member (profile page). */
export interface MemberRelation {
conversation_id: number | null;
state: ConversationState | null;
can_request: boolean;
eligible: boolean;
}
export type ConversationState = "accepted" | "incoming" | "outgoing" | "expired" | "blocked_by_me" | "closed";
export interface ConversationItem {
id: number;
other: ForumAuthor | null;
state: ConversationState;
intro: string;
created_at: string;
last_message_at: string | null;
last_message: { excerpt: string; mine: boolean } | null;
unread: number;
}
export interface ChatMessage {
id: number;
mine: boolean;
body: string;
created_at: string;
}
export interface ConversationPage {
viewer: ForumViewer;
conversation: {
id: number;
other: ForumAuthor | null;
state: ConversationState;
intro: string;
requested_by_me: boolean;
created_at: string;
};
messages: ChatMessage[];
}
export type ReportKind = "spam" | "ad" | "rude" | "crisis" | "illegal" | "other";
export const REPORT_KINDS: { kind: ReportKind; label: string }[] = [
{ kind: "rude", label: "Bántó, kioktató vagy sértő" },
{ kind: "ad", label: "Szolgáltatást hirdet (jóslás, gyógyítás, tanfolyam)" },
{ kind: "spam", label: "Kéretlen reklám, spam" },
{ kind: "crisis", label: "Aggódom érte: lelki krízisben lehet" },
{ kind: "illegal", label: "Jogsértő tartalom" },
{ kind: "other", label: "Más (írd le)" },
];
export interface ReportEntry {
id: number;
kind: ReportKind;
note: string;
reporter: string;
status: "open" | "resolved" | "dismissed";
handled_by: string | null;
handled_at: string | null;
created_at: string;
open_reports_of_target: number;
target:
| {
type: "post";
id: number;
thread: { id: number; title: string; slug: string };
author: ForumAuthor | null;
body: string;
deleted: boolean;
}
| {
type: "message";
id: number;
conversation_id: number | null;
messages: { id: number; sender: ForumAuthor | null; body: string; created_at: string; reported: boolean }[];
}
| null;
}
/** The forum menu's counts. */
export interface ForumNavData {
viewer: ForumViewer;
followed: { new_replies: number } | null;
messages: number | null;
reports: number | null;
}