Fix confirmation email: use MJML template, accept team preference, update Stripe label #383
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api#383
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone — discovered during registration flow audit (2026-04-07). Confirmation email hardcodes "March 24 tryout" details. Stripe product name says "Tryout Registration."
Repo
forgejo_admin/basketball-apiUser Story
As a parent who just paid for registration
I want the confirmation email to accurately confirm my registration with my credentials and a profile link
So that I'm not told to attend a tryout that already happened
Context
send_confirmation_email()inemail.py:65-170builds inline HTML via_build_confirmation_html()(lines 200-384) with hardcoded "Tuesday, March 24" tryout details at Kongo Gym. Theload_email_template()function (line 1107) already exists and is used by jersey-reminder — it loads compiled HTML from/data/email-templates/and does{{placeholder}}string replacement. The MJML template is being created in a parallel ticket inwestside-email-templates. Stripe Checkout Session product name is built inline atregister.py:1346as "Tryout Registration." The frontend is sending a new optionalteam_preferencefield in a parallel ticket.File Targets
Files to modify:
src/basketball_api/services/email.pysend_confirmation_email()(line 65): swap toload_email_template("registration-confirmation", data)f"{player.name}'s Registration Confirmed — {tenant.name}"_build_confirmation_html()entirelysrc/basketball_api/routes/register.pytype_labelfrom "Tryout" to "Registration" for Stripe product nameteam_preference: str | NoneFiles NOT to touch:
src/basketball_api/routes/register.pyGET handler (server-rendered form) — works finesrc/basketball_api/services/email.pyother email functions — separate scopesrc/basketball_api/brand.py— still used by server-rendered pagesAcceptance Criteria
load_email_template()_build_confirmation_html()no longer exists in codebaseTest Expectations
send_confirmation_email()with mock template file — verify placeholder replacementsend_confirmation_email()without template file — verify plaintext fallback/api/registerwith team_preference field — verify stored on Player/api/registerwithout team_preference — verify no errorpytest tests/ -k "test_register or test_email"Constraints
load_email_template()reads fromsettings.email_templates_dir(default/data/email-templates)credentials_blockas conditional HTML snippet — empty string when no credentialsPlayer.team_preferenceisTeamPreferenceenum (local/travel/both) — if frontend sends team name string, either map it or include raw in admin notification email for nowChecklist
_build_confirmation_html()deletedRelated
westside-basketball— projectforgejo_admin/westside-email-templates— provides the compiled MJML template (parallel ticket)forgejo_admin/westside-app— sends team_preference in POST (parallel ticket)pal-e-platform/docs/superpowers/specs/2026-04-07-registration-flow-fix-design.mdAPPROVED — file targets verified,
load_email_templateconfirmed, no other callers of_build_confirmation_html, no conflicts.Minor line range corrections (non-blocking):
_build_confirmation_html()ends at line 348, not 384. The function spans lines 200-348.APIRegistrationRequestschema is at line 1130 —team_preferencefield needs to be added there.Verified:
send_confirmation_email()at line 65 ✓_build_confirmation_html()at line 200 ✓load_email_template()at line 1107 with{{placeholder}}replacement ✓_build_confirmation_htmlonly called fromsend_confirmation_email()(lines 132-133) ✓Player.team_preferencefield exists asTeamPreferenceenum in models.py ✓type_labelat line 1346 ✓test_register.py,test_promo_registration.py,test_admin_email.pyall exist ✓email.pyorregister.py— no conflicts ✓