Forum: search, muting members, archived topics, the public threads in the sitemap

- Search (/forum/kereses, the magnifier in the forum bar): thread titles
  and posts the viewer may read, Hungarian stems and word beginnings
  without accents ("alvas" finds "alvásban"), one result per thread with
  the matching words marked.
- Muting a member (post menu, profile; the list in the settings): their
  threads leave the lists, their posts fold up, their replies and mentions
  no longer count or send e-mails. They are not told.
- The admin archives a topic (Moderálás → Témák): it stays readable but
  takes no new threads or replies, and folds away on the front page.
- The public topics and threads are in the sitemap; the forum's own pages
  are kept from robots.
- A reply e-mail goes to the one answered, also on the second level.
- Migration 0043 also prepares charts attached to a forum question.

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 14:31:05 +00:00
co-authored by Claude Opus 5.5
parent 4800a30e6d
commit 9ca3f478be
30 changed files with 879 additions and 105 deletions
@@ -27,6 +27,8 @@ type Actions = {
remove: (post: ForumPost) => void;
restore: (post: ForumPost) => void;
helped: (post: ForumPost) => void;
/** Mute or unmute the post's author. */
mute: (post: ForumPost) => void;
};
function ReactionRow({
@@ -187,6 +189,7 @@ function PostCard({
const [reporting, setReporting] = useState(false);
const [menu, setMenu] = useState(false);
const [showCollapsed, setShowCollapsed] = useState(false);
const [showMuted, setShowMuted] = useState(false);
const { viewer, thread, access } = page;
const writer = viewer.member !== null && !viewer.member.banned;
const starter = post.author !== null && post.author.nickname === thread.author?.nickname;
@@ -208,6 +211,17 @@ function PostCard({
);
}
// A muted member's post folds up; one click shows it.
if (post.muted && !showMuted) {
return (
<article className={nested ? "fp fp-muted fp-nested" : "fp fp-muted"} id={`h${post.id}`}>
<button type="button" className="fp-collapsed" onClick={() => setShowMuted(true)}>
{author?.nickname ?? "Egy tag"} hozzászólása · elnémítottad · Megjelenítés
</button>
</article>
);
}
const menuItems: { label: string; run: () => void; danger?: boolean }[] = [];
if (!post.deleted) {
if (access?.is_thread_author && !post.is_opening && !post.own && writer) {
@@ -216,6 +230,11 @@ function PostCard({
if (post.own && writer && !thread.locked) menuItems.push({ label: "Szerkesztés", run: () => setEditing(true) });
if (post.own) menuItems.push({ label: "Törlés", run: () => actions.remove(post), danger: true });
if (viewer.logged_in && !post.own) menuItems.push({ label: "Jelentés", run: () => setReporting(true) });
if (viewer.member && !post.own && author && !post.system)
menuItems.push({
label: post.muted ? `${author.nickname} némításának feloldása` : `${author.nickname} némítása`,
run: () => actions.mute(post),
});
if (viewer.moderator && !post.own)
menuItems.push({ label: "Eltávolítás", run: () => actions.remove(post), danger: true });
} else if (viewer.moderator) {
@@ -515,6 +534,21 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
await api(`/forum/posts/${post.id}/restore`, { method: "POST" });
await reload();
}),
mute: (post) => {
const nickname = post.author?.nickname;
if (!nickname) return;
if (
!post.muted &&
!window.confirm(
`Elnémítod ${nickname} tagot? A szálai eltűnnek a listáidból, a hozzászólásai összecsukva látszanak, és nem kapsz értesítést tőle. Ő erről nem tud. A beállításoknál bármikor feloldhatod.`,
)
)
return;
void run(async () => {
await api(`/forum/members/${encodeURIComponent(nickname)}/mute`, { method: post.muted ? "DELETE" : "PUT" });
await reload();
});
},
helped: (post) =>
void run(async () => {
const updated = await api<ForumPost>(`/forum/posts/${post.id}/helped`, {
@@ -738,7 +772,11 @@ export function ThreadView({ initial }: { initial: ThreadPage }) {
) : viewer.member?.banned ? (
<p className="ftv-gate">Most nem írhatsz a fórumba.</p>
) : !access?.can_reply ? (
<p className="ftv-gate">Ez a szál le van zárva, új hozzászólás nem írható.</p>
<p className="ftv-gate">
{thread.topic.archived
? "Ez a téma archivált: olvasható, de új hozzászólás nem írható."
: "Ez a szál le van zárva, új hozzászólás nem írható."}
</p>
) : (
<>
<Composer