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
+3 -3
View File
@@ -130,7 +130,7 @@ pub async fn listeners_once(db: &PgPool, base_url: &str) -> Result<usize, sqlx::
let threads: Vec<(i64, String, Option<Uuid>)> = sqlx::query_as(&format!(
"SELECT th.id, th.title, th.author_id FROM forum.threads th JOIN forum.topics tp ON tp.id = th.topic_id \
WHERE th.reply_count = 0 AND NOT th.locked AND th.deleted_at IS NULL AND NOT th.system \
AND th.listeners_notified_at IS NULL AND tp.visibility <> 'restricted' \
AND th.listeners_notified_at IS NULL AND tp.visibility <> 'restricted' AND tp.archived_at IS NULL \
AND (th.intent = 'listen' OR tp.listening) \
AND th.created_at < now() - interval '{LISTENER_AFTER}' AND th.created_at > now() - interval '3 days' \
ORDER BY th.created_at LIMIT 20 FOR UPDATE OF th SKIP LOCKED"
@@ -190,7 +190,7 @@ pub async fn weekly_once(db: &PgPool, base_url: &str, any_time: bool) -> Result<
let busy: Vec<(i64, String, i64)> = sqlx::query_as(
"SELECT th.id, th.title, count(p.id) FROM forum.threads th JOIN forum.topics tp ON tp.id = th.topic_id \
JOIN forum.posts p ON p.thread_id = th.id AND p.deleted_at IS NULL AND p.created_at > now() - interval '7 days' \
WHERE th.deleted_at IS NULL AND tp.visibility <> 'restricted' \
WHERE th.deleted_at IS NULL AND tp.visibility <> 'restricted' AND tp.archived_at IS NULL \
GROUP BY th.id, th.title ORDER BY count(p.id) DESC, max(p.id) DESC LIMIT 5",
)
.fetch_all(db)
@@ -198,7 +198,7 @@ pub async fn weekly_once(db: &PgPool, base_url: &str, any_time: bool) -> Result<
let waiting: Vec<String> = sqlx::query_scalar(
"SELECT th.title FROM forum.threads th JOIN forum.topics tp ON tp.id = th.topic_id \
WHERE th.reply_count = 0 AND th.deleted_at IS NULL AND NOT th.locked AND NOT th.system \
AND tp.visibility <> 'restricted' AND th.created_at > now() - interval '7 days' \
AND tp.visibility <> 'restricted' AND tp.archived_at IS NULL AND th.created_at > now() - interval '7 days' \
ORDER BY th.created_at LIMIT 3",
)
.fetch_all(db)
+1 -1
View File
@@ -224,7 +224,7 @@ pub async fn run_once(db: &PgPool, http: &reqwest::Client, backend_url: &str, an
let mut tx = db.begin().await?;
let thread: Option<i64> = sqlx::query_scalar(
"INSERT INTO forum.threads (topic_id, author_id, title, system, pinned, daily_date) \
SELECT id, NULL, $2, true, true, (now() AT TIME ZONE 'Europe/Budapest')::date FROM forum.topics WHERE slug = $1 \
SELECT id, NULL, $2, true, true, (now() AT TIME ZONE 'Europe/Budapest')::date FROM forum.topics WHERE slug = $1 AND archived_at IS NULL \
ON CONFLICT (daily_date) DO NOTHING RETURNING id",
)
.bind(TOPIC)