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:
@@ -66,6 +66,8 @@ pub struct Viewer {
|
||||
pub member: Option<Member>,
|
||||
/// The restricted topics the member was approved into.
|
||||
pub topics: Vec<i16>,
|
||||
/// The members they muted.
|
||||
pub mutes: Vec<Uuid>,
|
||||
}
|
||||
|
||||
impl Viewer {
|
||||
@@ -137,15 +139,22 @@ impl FromRequestParts<Arc<AppState>> for Viewer {
|
||||
.execute(&state.db)
|
||||
.await?;
|
||||
}
|
||||
let topics = if member.is_some() {
|
||||
sqlx::query_scalar("SELECT topic_id FROM forum.topic_members WHERE user_id = $1 AND status = 'approved'")
|
||||
let (topics, mutes) = if member.is_some() {
|
||||
let topics = sqlx::query_scalar(
|
||||
"SELECT topic_id FROM forum.topic_members WHERE user_id = $1 AND status = 'approved'",
|
||||
)
|
||||
.bind(user.id)
|
||||
.fetch_all(&state.db)
|
||||
.await?;
|
||||
let mutes = sqlx::query_scalar("SELECT muted_id FROM forum.mutes WHERE user_id = $1")
|
||||
.bind(user.id)
|
||||
.fetch_all(&state.db)
|
||||
.await?
|
||||
.await?;
|
||||
(topics, mutes)
|
||||
} else {
|
||||
Vec::new()
|
||||
(Vec::new(), Vec::new())
|
||||
};
|
||||
Ok(Viewer { user: Some(user), member, topics })
|
||||
Ok(Viewer { user: Some(user), member, topics, mutes })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user