Invitations with a package; promo codes fill up the balance
CI / test (push) Successful in 1m15s
CI / build (push) Successful in 5m15s
CI / deploy (push) Skipped

An admin can pick a package when inviting: each invitee gets a promo code
(in the e-mail and its preview, kept on resend), redeemed by itself at sign
up; revoking the invitation withdraws it, and the list shows the package.

Redeeming a promo code now fills the units up to the package's amounts:
used units come back, more than that stays. A code that would add nothing
stays open, with a message saying so; the answer tells what was added.

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-19 09:57:01 +00:00
co-authored by Claude Opus 5.5
parent 054fb930f5
commit 7b23d71526
13 changed files with 458 additions and 66 deletions
+16 -2
View File
@@ -216,7 +216,14 @@ pub async fn register(
.bind(&email)
.execute(&mut *tx)
.await?;
super::invitations::mark_accepted(&mut tx, user_id, &email, req.invite_token.as_deref()).await?;
super::invitations::mark_accepted(
&mut tx,
user_id,
&email,
req.invite_token.as_deref(),
state.config.free_person_slots,
)
.await?;
let mut user = load_user(&mut tx, user_id).await?;
apply_bootstrap_admin(&state, &mut tx, &mut user).await?;
queue_verification(&state, &mut tx, &user).await?;
@@ -347,7 +354,14 @@ pub async fn google(
.bind(locale)
.execute(&mut *tx)
.await?;
super::invitations::mark_accepted(&mut tx, id, &email, req.invite_token.as_deref()).await?;
super::invitations::mark_accepted(
&mut tx,
id,
&email,
req.invite_token.as_deref(),
state.config.free_person_slots,
)
.await?;
(id, true)
}
};