Privacy policy: the forum, and the export and retention it states

Both languages: rows for the forum profile, posts, last visit, private
conversations, reports and the moderation log (DSA legal obligation);
what is public and what moderators see; forum content never goes to AI;
retention periods; the forum theme cookie; the rights (the export covers
the forum, posts kept as "Törölt tag" can be deleted on request). In
force from 2026-11-26.

So that it holds: the account export includes the forum, and the hourly
cleanup clears text removed by moderators after a year, closed reports
and old ban reasons after a year, the moderation log after two years,
and requests never accepted after 90 days.

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 11:26:09 +00:00
co-authored by Claude Opus 5.5
parent da42c92e71
commit 88d9a5df3e
8 changed files with 290 additions and 16 deletions
+62
View File
@@ -273,6 +273,14 @@ async fn cleanup_removes_only_expired_data(db: PgPool) {
("prompt_previews", 0),
("generation_errors", 0),
("gifts", 1),
("forum_removed_posts", 0),
("forum_removed_threads", 0),
("forum_removed_titles", 0),
("forum_nicknames", 0),
("forum_reports", 0),
("forum_mod_log", 0),
("forum_bans", 0),
("forum_requests", 0),
]
);
let kept: Vec<Uuid> = sqlx::query_scalar("SELECT id FROM gifts ORDER BY id").fetch_all(&db).await.unwrap();
@@ -282,6 +290,60 @@ async fn cleanup_removes_only_expired_data(db: PgPool) {
assert_eq!(left, vec![recent, unsent]);
}
#[sqlx::test(migrator = "db::MIGRATOR")]
async fn cleanup_keeps_the_forum_retention_periods(db: PgPool) {
let (anna, bea) = (Uuid::now_v7(), Uuid::now_v7());
for (id, email) in [(anna, "anna@example.com"), (bea, "bea@example.com")] {
sqlx::query("INSERT INTO users (id, email) VALUES ($1, $2)").bind(id).bind(email).execute(&db).await.unwrap();
}
let thread: i64 = sqlx::query_scalar(
"INSERT INTO forum.threads (topic_id, author_id, title) VALUES (2, $1, 'Csend') RETURNING id",
)
.bind(anna)
.fetch_one(&db)
.await
.unwrap();
// Removed 13 months ago, removed last week, never removed.
let mut posts = Vec::new();
for removed in ["now() - interval '13 months'", "now() - interval '7 days'", "NULL"] {
let id: i64 = sqlx::query_scalar(&format!(
"INSERT INTO forum.posts (thread_id, author_id, body, deleted_at, delete_reason) VALUES ($1, $2, 'szöveg', {removed}, 'hirdetés') RETURNING id"
))
.bind(thread)
.bind(bea)
.fetch_one(&db)
.await
.unwrap();
posts.push(id);
}
// A request declined long ago goes; an old conversation with messages stays.
let (a, b) = if anna < bea { (anna, bea) } else { (bea, anna) };
sqlx::query(
"INSERT INTO forum.conversations (user_a, user_b, requested_by, intro, status, created_at, responded_at, last_message_at) VALUES ($1, $2, $1, 'Szia', 'declined', now() - interval '100 days', now() - interval '100 days', NULL)",
)
.bind(a)
.bind(b)
.execute(&db)
.await
.unwrap();
let done = crate::cleanup::run_once(&db).await.unwrap();
let count = |what: &str| done.iter().find(|(w, _)| *w == what).unwrap().1;
assert_eq!((count("forum_removed_posts"), count("forum_requests")), (1, 1));
let bodies: Vec<String> = sqlx::query_scalar("SELECT body FROM forum.posts WHERE id = ANY($1) ORDER BY id")
.bind(&posts)
.fetch_all(&db)
.await
.unwrap();
assert_eq!(bodies, vec!["", "szöveg", "szöveg"], "only the text removed over a year ago goes");
let reason: Option<String> = sqlx::query_scalar("SELECT delete_reason FROM forum.posts WHERE id = $1")
.bind(posts[0])
.fetch_one(&db)
.await
.unwrap();
assert_eq!(reason.as_deref(), Some("hirdetés"), "its place and reason stay");
}
// --- analyses ----------------------------------------------------------------------------
#[test]