ÁSZF: the forum chapter, and the moderation e-mails it promises
A new point 8 (the old 8–11 become 9–12): reading, writing and the nickname, the house rules, posts (they stay as "Törölt tag" after an account is deleted), private messages, ranks and limits, reports and moderation under the DSA (receipt, decision notice, statement of reasons, objection, point of contact; every decision is made by a person), notifications. In force from 2026-11-26 (TERMS_UPDATED, TERMS_VERSION). So that it holds: the member gets an e-mail with the reason when a moderator removes their post or thread or bans them, and every reporter gets the decision on their report, whatever their notification settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -104,6 +104,15 @@ impl TestApp {
|
||||
(status, value)
|
||||
}
|
||||
|
||||
/// The queued e-mails of a template: (recipient, payload), oldest first.
|
||||
async fn mails(&self, template: &str) -> Vec<(String, Value)> {
|
||||
sqlx::query_as("SELECT to_email, payload FROM email_outbox WHERE template = $1 ORDER BY created_at, id")
|
||||
.bind(template)
|
||||
.fetch_all(&self.pool)
|
||||
.await
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
async fn get(&self, uri: &str, user: Option<&User>) -> Value {
|
||||
let (status, body) = self.call("GET", uri, user, Value::Null).await;
|
||||
assert_eq!(status, StatusCode::OK, "GET {uri}: {body}");
|
||||
@@ -373,6 +382,14 @@ async fn moderators_remove_and_ban(pool: PgPool) {
|
||||
assert_eq!(seen["posts"][1]["deleted"]["by_moderator"], true);
|
||||
let seen = app.get(&format!("/v1/forum/threads/{thread}"), Some(&moderator)).await;
|
||||
assert!(seen["posts"][1]["body"].is_string(), "moderators still see the text");
|
||||
// The author is told what and why (whatever their notification settings).
|
||||
let told = app.mails("forum_moderation").await;
|
||||
assert_eq!(told.len(), 1);
|
||||
assert_eq!(told[0].0, "spam@example.com");
|
||||
assert_eq!(told[0].1["action"], "post_removed");
|
||||
assert_eq!(told[0].1["reason"], "szolgáltatás hirdetése");
|
||||
assert_eq!(told[0].1["thread_title"], "Energiák");
|
||||
assert_eq!(told[0].1["nickname"], "Gyógyító");
|
||||
|
||||
// Only the admin restores.
|
||||
let (status, _) =
|
||||
@@ -386,6 +403,8 @@ async fn moderators_remove_and_ban(pool: PgPool) {
|
||||
.call("POST", "/v1/forum/members/gyogyito/ban", Some(&moderator), json!({ "hours": 48, "reason": "hirdetés" }))
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::OK, "{body}");
|
||||
let told = app.mails("forum_moderation").await;
|
||||
assert_eq!((told[1].1["action"].as_str(), told[1].1["duration"].as_str()), (Some("banned"), Some("2 napos")));
|
||||
let (status, body) = app
|
||||
.call("POST", &format!("/v1/forum/threads/{thread}/posts"), Some(&spam), json!({ "body": "Még egyszer" }))
|
||||
.await;
|
||||
@@ -573,6 +592,12 @@ async fn reports_reach_moderators(pool: PgPool) {
|
||||
assert_eq!(status, StatusCode::NO_CONTENT);
|
||||
let list = app.get("/v1/forum/mod/reports", Some(&moderator)).await;
|
||||
assert!(list["reports"].as_array().unwrap().iter().all(|r| r["status"] == "resolved"));
|
||||
// Both reporters hear the decision, once each.
|
||||
let told = app.mails("forum_report_result").await;
|
||||
let mut to: Vec<&str> = told.iter().map(|(t, _)| t.as_str()).collect();
|
||||
to.sort_unstable();
|
||||
assert_eq!(to, vec!["anna@example.com", "cili@example.com"]);
|
||||
assert!(told.iter().all(|(_, p)| p["outcome"] == "removed"));
|
||||
assert_eq!(app.get("/v1/forum/nav", Some(&moderator)).await["reports"], 0);
|
||||
|
||||
// A report can also be dismissed.
|
||||
@@ -583,6 +608,8 @@ async fn reports_reach_moderators(pool: PgPool) {
|
||||
.call("POST", &format!("/v1/forum/mod/reports/{id}"), Some(&moderator), json!({ "action": "dismiss" }))
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::NO_CONTENT);
|
||||
let told = app.mails("forum_report_result").await;
|
||||
assert_eq!((told[2].0.as_str(), told[2].1["outcome"].as_str()), ("anna@example.com", Some("no_violation")));
|
||||
let log = app.get("/v1/forum/mod/log", Some(&moderator)).await;
|
||||
assert_eq!(log["entries"][0]["action"], "dismiss_report");
|
||||
assert_eq!(log["entries"][0]["target"], "Holdfény");
|
||||
|
||||
Reference in New Issue
Block a user