Á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:
@@ -186,6 +186,8 @@ pub fn render(template: &str, locale: &str, payload: &Value) -> Result<Rendered,
|
||||
("forum_reply", _) => forum_reply(payload, url)?,
|
||||
("forum_digest", _) => forum_digest(payload, url)?,
|
||||
("forum_message", _) => forum_message(payload, url)?,
|
||||
("forum_moderation", _) => forum_moderation(payload, url)?,
|
||||
("forum_report_result", _) => forum_report_result(payload, url)?,
|
||||
_ => return Err(TemplateError::UnknownTemplate(template.to_owned())),
|
||||
};
|
||||
Ok(content.render(lang))
|
||||
@@ -425,6 +427,83 @@ fn forum_message(payload: &Value, url: String) -> Result<Content, TemplateError>
|
||||
forum_footer(payload, content, "a fórumon értesítést kértél a privát üzenetekről")
|
||||
}
|
||||
|
||||
/// A moderation step concerning the member (the DSA's statement of reasons):
|
||||
/// what happened, why, on what ground, and how to object. Sent whatever the
|
||||
/// member's notification settings.
|
||||
fn forum_moderation(payload: &Value, url: String) -> Result<Content, TemplateError> {
|
||||
let reason = excerpt(payload, "reason", 300).ok_or(TemplateError::MissingField("reason"))?;
|
||||
let title = name(payload, "thread_title");
|
||||
let in_thread = title.as_deref().map(|t| format!(" a(z) „{t}” szálban")).unwrap_or_default();
|
||||
let (subject, intro) = match payload["action"].as_str() {
|
||||
Some("post_removed") => (
|
||||
"Eltávolítottuk egy hozzászólásodat".to_owned(),
|
||||
format!(
|
||||
"Egy moderátor eltávolította egy hozzászólásodat{in_thread}. A hozzászólás helyén ez az indoklás látszik:"
|
||||
),
|
||||
),
|
||||
Some("thread_removed") => (
|
||||
"Eltávolítottuk egy száladat".to_owned(),
|
||||
format!("Egy moderátor eltávolította a száladat{in_thread}. A szál helyén ez az indoklás látszik:"),
|
||||
),
|
||||
Some("banned") => match name(payload, "duration") {
|
||||
Some(d) => (
|
||||
"Egy ideig nem írhatsz a fórumba".to_owned(),
|
||||
format!(
|
||||
"Egy moderátor {d} időre eltiltott a fórumon az írástól. Olvasni továbbra is tudsz. Az indoklás:"
|
||||
),
|
||||
),
|
||||
None => (
|
||||
"Kitiltottunk a fórumról".to_owned(),
|
||||
"Egy moderátor véglegesen eltiltott a fórumon az írástól. Olvasni továbbra is tudsz. Az indoklás:"
|
||||
.to_owned(),
|
||||
),
|
||||
},
|
||||
_ => return Err(TemplateError::MissingField("action")),
|
||||
};
|
||||
Ok(Content {
|
||||
subject,
|
||||
preheader: None,
|
||||
greeting: hello(payload),
|
||||
intro,
|
||||
quote: Some(reason),
|
||||
points: None,
|
||||
code: None,
|
||||
button: "A fórum házirendje",
|
||||
url,
|
||||
note: "A döntés alapja a fórum házirendje (ÁSZF 8. pont). Ha szerinted tévedés történt, válaszolj erre a levélre, vagy írj az info@sorsfonalak.hu címre: a döntést egy másik moderátor vagy az üzemeltető vizsgálja felül. A megvásárolt szolgáltatásaidat ez nem érinti.".into(),
|
||||
reason: Some("Ezt a levelet azért kapod, mert a fórumon egy moderálási döntés érintett.".into()),
|
||||
unsubscribe: None,
|
||||
unsubscribe_post_url: None,
|
||||
})
|
||||
}
|
||||
|
||||
/// The decision on a report the member sent.
|
||||
fn forum_report_result(payload: &Value, url: String) -> Result<Content, TemplateError> {
|
||||
let intro = match payload["outcome"].as_str() {
|
||||
Some("removed") => "Köszönjük a jelentésedet. Megnéztük, és a tartalmat eltávolítottuk.",
|
||||
Some("handled") => "Köszönjük a jelentésedet. Megnéztük, és intézkedtünk.",
|
||||
Some("no_violation") => {
|
||||
"Köszönjük a jelentésedet. Megnéztük, de nem találtunk benne a házirendbe ütköző dolgot, ezért a tartalom marad."
|
||||
}
|
||||
_ => return Err(TemplateError::MissingField("outcome")),
|
||||
};
|
||||
Ok(Content {
|
||||
subject: "Elbíráltuk a jelentésedet".into(),
|
||||
preheader: None,
|
||||
greeting: hello(payload),
|
||||
intro: intro.into(),
|
||||
quote: None,
|
||||
points: None,
|
||||
code: None,
|
||||
button: "Vissza a fórumra",
|
||||
url,
|
||||
note: "Ha nem értesz egyet a döntéssel, írj az info@sorsfonalak.hu címre.".into(),
|
||||
reason: Some("Ezt a levelet azért kapod, mert a fórumon jelentettél egy tartalmat.".into()),
|
||||
unsubscribe: None,
|
||||
unsubscribe_post_url: None,
|
||||
})
|
||||
}
|
||||
|
||||
fn field(payload: &Value, name: &'static str) -> Result<String, TemplateError> {
|
||||
payload[name].as_str().filter(|u| !u.is_empty()).map(str::to_owned).ok_or(TemplateError::MissingField(name))
|
||||
}
|
||||
@@ -1267,5 +1346,26 @@ mod tests {
|
||||
let m = render("forum_message", "hu", &p).unwrap();
|
||||
assert_eq!(m.subject, "Zöldág beszélgetni szeretne veled");
|
||||
assert!(m.text.contains("titkos"), "a request's introduction is shown");
|
||||
|
||||
let p = json!({
|
||||
"url": "https://sorsfonalak.hu/aszf#forum", "nickname": "Gyógyító", "action": "banned",
|
||||
"duration": "3 napos", "reason": "szolgáltatás hirdetése",
|
||||
});
|
||||
let m = render("forum_moderation", "hu", &p).unwrap();
|
||||
assert_eq!(m.subject, "Egy ideig nem írhatsz a fórumba");
|
||||
assert!(m.text.contains("3 napos időre") && m.text.contains("> szolgáltatás hirdetése"));
|
||||
assert!(m.text.contains("ÁSZF 8. pont") && m.unsubscribe_post_url.is_none());
|
||||
let m = render("forum_moderation", "hu", &json!({"url": "u", "action": "banned", "reason": "x"})).unwrap();
|
||||
assert_eq!(m.subject, "Kitiltottunk a fórumról");
|
||||
let m = render(
|
||||
"forum_moderation",
|
||||
"hu",
|
||||
&json!({"url": "u", "action": "post_removed", "reason": "sértő", "thread_title": "Téli levesek"}),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(m.text.contains("a(z) „Téli levesek” szálban"));
|
||||
let m = render("forum_report_result", "hu", &json!({"url": "u", "outcome": "no_violation"})).unwrap();
|
||||
assert!(m.text.starts_with("Szia!") && m.text.contains("a tartalom marad"));
|
||||
assert!(render("forum_report_result", "hu", &json!({"url": "u"})).is_err());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user