Forum: the "Alapító tag" badge for the first hundred members
The first hundred members (in the order they chose a nickname) keep it for good; joining is serialised so there are never more than a hundred. Shown next to the nickname in posts, author lines and profiles; the privacy notice mentions it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -1314,3 +1314,26 @@ async fn a_question_about_ones_chart(pool: PgPool) {
|
||||
.unwrap();
|
||||
assert!(revoked);
|
||||
}
|
||||
|
||||
#[sqlx::test(migrator = "db::MIGRATOR")]
|
||||
async fn the_first_hundred_are_founders(pool: PgPool) {
|
||||
let app = TestApp::new(pool);
|
||||
let anna = app.member("anna@example.com", "Csendesvíz", &["user"]).await;
|
||||
// Ninety-nine more founders already (made up), then Bea comes too late.
|
||||
sqlx::query(
|
||||
"WITH u AS (INSERT INTO users (id, email, display_name) \
|
||||
SELECT gen_random_uuid(), 'f' || n || '@example.invalid', 'F' FROM generate_series(1, 99) n \
|
||||
RETURNING id, email) \
|
||||
INSERT INTO forum.members (user_id, nickname, nickname_key, avatar, founder) \
|
||||
SELECT id, 'Alapito ' || email, 'alapito ' || email, 'hold-ejkek', true FROM u",
|
||||
)
|
||||
.execute(&app.pool)
|
||||
.await
|
||||
.unwrap();
|
||||
let bea = app.member("bea@example.com", "Holdfény", &["user"]).await;
|
||||
let thread = app.thread(&anna, "torzsasztal", "Sziasztok").await;
|
||||
app.reply(&bea, thread, "Szia!", None).await;
|
||||
let shown = app.get(&format!("/v1/forum/threads/{thread}"), None).await;
|
||||
assert_eq!(shown["posts"][0]["author"]["founder"], true);
|
||||
assert_eq!(shown["posts"][1]["author"]["founder"], false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user