Forum: daily sky thread, listeners, mentions, own avatars, restricted topics

- The worker opens a "Mai égbolt" thread every morning from the day's sky
  (no AI), pinned for the day.
- Volunteer listeners (from the Kereső rank) get a badge, a count of the
  threads asking to be heard that still wait for a reply, and, if they ask,
  an e-mail after two hours of waiting.
- "@Holdfény" names a member (nicknames with spaces too): they follow the
  thread, hear of it live and, if they asked, by e-mail; a search helps
  typing it.
- From the Kereső rank a member may upload an own avatar: a small square
  JPEG without metadata in the object storage (now a shared crate with the
  backend), served by the forum; moderators can put the starter back.
- The "Támogató" badge for buyers who switch it on.
- The admin creates and edits topics; restricted ones are read by their
  approved members, who ask to join and moderators decide.
- "Most itt vannak" on the front page; the weekly summary e-mail on Sunday
  evening for those who ask (off by default).

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 12:37:52 +00:00
co-authored by Claude Opus 5.5
parent 0a2308c491
commit 564c22176f
31 changed files with 2226 additions and 320 deletions
+18 -2
View File
@@ -38,10 +38,16 @@ pub struct Member {
pub email_replies: String,
pub email_followed: String,
pub email_messages: String,
pub email_mentions: String,
pub email_listener: String,
pub email_weekly: bool,
pub listener: bool,
pub supporter_badge: bool,
}
pub const MEMBER_COLUMNS: &str = "user_id, nickname, avatar, bio, chart_share, invisible, points, post_count, \
created_at, nickname_changed_at, banned_until, ban_reason, email_replies, email_followed, email_messages";
created_at, nickname_changed_at, banned_until, ban_reason, email_replies, email_followed, email_messages, \
email_mentions, email_listener, email_weekly, listener, supporter_badge";
impl Member {
pub fn rank(&self, now: OffsetDateTime) -> Rank {
@@ -58,6 +64,8 @@ impl Member {
pub struct Viewer {
pub user: Option<User>,
pub member: Option<Member>,
/// The restricted topics the member was approved into.
pub topics: Vec<i16>,
}
impl Viewer {
@@ -129,7 +137,15 @@ impl FromRequestParts<Arc<AppState>> for Viewer {
.execute(&state.db)
.await?;
}
Ok(Viewer { user: Some(user), member })
let topics = if member.is_some() {
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?
} else {
Vec::new()
};
Ok(Viewer { user: Some(user), member, topics })
}
}