feat: add brand_color placeholder to email templates for Queens pink #344

Closed
opened 2026-04-05 19:02:11 +00:00 by forgejo_admin · 3 comments
Contributor

Type

Feature

Lineage

Discovered during Kiana/Kelsie contract email send (2026-04-05). Queens emails rendered with Kings red CTA button. Worked around with runtime html.replace('#d42026', '#e91e8c') in kubectl ad-hoc send — never committed.

Repo

forgejo_admin/basketball-api

User Story

As a Queens parent receiving a contract email, I want the email branding to match the Queens pink color scheme so that the email feels consistent with the contract page.

Context

The compiled email templates in /data/email-templates/ (mounted from ~/westside-email-templates/compiled/ on the host) have hardcoded #d42026 (Kings red) for CTA buttons and accent elements. Queens emails should use #e91e8c (Queens pink).

The templates are compiled MJML → HTML files stored in a local directory (~/westside-email-templates/compiled/), NOT a git repo. They're mounted into the basketball-api pod at /data/email-templates/. To update a template, edit the compiled HTML file on the host and the running pod picks it up.

The load_email_template() function in email.py (line 1107) does {{key}} → value replacement. Adding {{brand_color}} as a placeholder follows the existing pattern.

#d42026 appears in all 3 templates: action.html (10x), announcement.html (13x), notification.html (9x). This ticket parameterizes ALL of them — they all need brand-aware color.

File Targets

  • ~/westside-email-templates/compiled/action.html — replace all #d42026 with {{brand_color}}
  • ~/westside-email-templates/compiled/announcement.html — same
  • ~/westside-email-templates/compiled/notification.html — same
  • src/basketball_api/services/email.py — update load_email_template() to default brand_color to #d42026 if not provided in data dict. This ensures backwards compatibility — existing callers that don't pass brand_color get Kings red.

Files NOT inside a git repo: the compiled templates are on the host filesystem. Agent should edit them directly at ~/westside-email-templates/compiled/.

Acceptance Criteria

  • All instances of #d42026 in action.html replaced with {{brand_color}}
  • All instances of #d42026 in announcement.html replaced with {{brand_color}}
  • All instances of #d42026 in notification.html replaced with {{brand_color}}
  • load_email_template() injects brand_color: '#d42026' into data dict if not provided (backwards compat)
  • Queens email sent with brand_color: '#e91e8c' renders pink CTA button
  • Kings email sent without brand_color renders red CTA button (default)
  • No runtime string replace hack needed

Test Expectations

  • Existing tests pass: pytest tests/
  • Manual: send test email with brand_color='#e91e8c', verify pink button
  • Manual: send test email without brand_color, verify red button (default)
  • Run command: pytest tests/

Constraints

  • Must be backwards compatible — all existing callers omit brand_color and should get #d42026 by default
  • Template files are NOT in a git repo — edit directly on host filesystem
  • The jersey-reminder.html template uses a different color scheme — leave it alone

Checklist

  • Templates updated on host
  • email.py updated with default
  • PR opened (for email.py change only)
  • Tests pass
  • Manual verification
  • westside-basketball — parent project
  • Architecture: arch-contracts-westside-basketball
  • forgejo_admin/westside-contracts#34 — parent data-driven contracts work
### Type Feature ### Lineage Discovered during Kiana/Kelsie contract email send (2026-04-05). Queens emails rendered with Kings red CTA button. Worked around with runtime `html.replace('#d42026', '#e91e8c')` in kubectl ad-hoc send — never committed. ### Repo `forgejo_admin/basketball-api` ### User Story As a Queens parent receiving a contract email, I want the email branding to match the Queens pink color scheme so that the email feels consistent with the contract page. ### Context The compiled email templates in `/data/email-templates/` (mounted from `~/westside-email-templates/compiled/` on the host) have hardcoded `#d42026` (Kings red) for CTA buttons and accent elements. Queens emails should use `#e91e8c` (Queens pink). The templates are compiled MJML → HTML files stored in a local directory (`~/westside-email-templates/compiled/`), NOT a git repo. They're mounted into the basketball-api pod at `/data/email-templates/`. To update a template, edit the compiled HTML file on the host and the running pod picks it up. The `load_email_template()` function in `email.py` (line 1107) does `{{key}}` → value replacement. Adding `{{brand_color}}` as a placeholder follows the existing pattern. `#d42026` appears in all 3 templates: action.html (10x), announcement.html (13x), notification.html (9x). This ticket parameterizes ALL of them — they all need brand-aware color. ### File Targets - `~/westside-email-templates/compiled/action.html` — replace all `#d42026` with `{{brand_color}}` - `~/westside-email-templates/compiled/announcement.html` — same - `~/westside-email-templates/compiled/notification.html` — same - `src/basketball_api/services/email.py` — update `load_email_template()` to default `brand_color` to `#d42026` if not provided in data dict. This ensures backwards compatibility — existing callers that don't pass brand_color get Kings red. Files NOT inside a git repo: the compiled templates are on the host filesystem. Agent should edit them directly at `~/westside-email-templates/compiled/`. ### Acceptance Criteria - [ ] All instances of `#d42026` in action.html replaced with `{{brand_color}}` - [ ] All instances of `#d42026` in announcement.html replaced with `{{brand_color}}` - [ ] All instances of `#d42026` in notification.html replaced with `{{brand_color}}` - [ ] `load_email_template()` injects `brand_color: '#d42026'` into data dict if not provided (backwards compat) - [ ] Queens email sent with `brand_color: '#e91e8c'` renders pink CTA button - [ ] Kings email sent without brand_color renders red CTA button (default) - [ ] No runtime string replace hack needed ### Test Expectations - [ ] Existing tests pass: `pytest tests/` - [ ] Manual: send test email with `brand_color='#e91e8c'`, verify pink button - [ ] Manual: send test email without brand_color, verify red button (default) - Run command: `pytest tests/` ### Constraints - Must be backwards compatible — all existing callers omit brand_color and should get #d42026 by default - Template files are NOT in a git repo — edit directly on host filesystem - The jersey-reminder.html template uses a different color scheme — leave it alone ### Checklist - [ ] Templates updated on host - [ ] email.py updated with default - [ ] PR opened (for email.py change only) - [ ] Tests pass - [ ] Manual verification ### Related - `westside-basketball` — parent project - Architecture: `arch-contracts-westside-basketball` - `forgejo_admin/westside-contracts#34` — parent data-driven contracts work
Author
Contributor

Scope Review: NEEDS_REFINEMENT

Review note: review-837-2026-04-03
Ticket has good template coverage and full traceability, but file targets and repo placement need fixes before an agent can execute.

  • File target path wrong: westside-email-templates/compiled/action.html is not inside basketball-api — it's a standalone local directory (~/westside-email-templates), not a git repo. Agent needs to know how the template is versioned and deployed to /data/email-templates.
  • Missing caller identification: No send_contract_offer_email function exists in email.py. Issue says "update callers" but doesn't say which function/route sends contract offer emails via load_email_template("action", ...).
  • Hack location unclear: html.replace('#d42026', '#e91e8c') not found in codebase — may have been ad-hoc. Clarify if AC #3 (remove hack) is applicable.
  • Missing AC: Add explicit "default brand_color is #d42026 when not provided" criterion.
  • Blast radius: #d42026 hardcoded in 3/5 templates (announcement: 13, action: 10, notification: 9). Scope decision needed on whether to parameterize all or just action.html.
## Scope Review: NEEDS_REFINEMENT Review note: `review-837-2026-04-03` Ticket has good template coverage and full traceability, but file targets and repo placement need fixes before an agent can execute. - **File target path wrong**: `westside-email-templates/compiled/action.html` is not inside basketball-api — it's a standalone local directory (`~/westside-email-templates`), not a git repo. Agent needs to know how the template is versioned and deployed to `/data/email-templates`. - **Missing caller identification**: No `send_contract_offer_email` function exists in email.py. Issue says "update callers" but doesn't say which function/route sends contract offer emails via `load_email_template("action", ...)`. - **Hack location unclear**: `html.replace('#d42026', '#e91e8c')` not found in codebase — may have been ad-hoc. Clarify if AC #3 (remove hack) is applicable. - **Missing AC**: Add explicit "default brand_color is #d42026 when not provided" criterion. - **Blast radius**: `#d42026` hardcoded in 3/5 templates (announcement: 13, action: 10, notification: 9). Scope decision needed on whether to parameterize all or just action.html.
Author
Contributor

Scope Review: READY (re-review)

Review note: review-837-2026-04-03

All 5 issues from previous review resolved. Template completeness verified, traceability complete, all 4 file targets confirmed on disk, blast radius contained (3 templates + email.py default). 7 AC items assessed as within 5-minute rule (homogeneous find-replace work). No decomposition needed. Ticket is ready for dispatch.

## Scope Review: READY (re-review) Review note: `review-837-2026-04-03` All 5 issues from previous review resolved. Template completeness verified, traceability complete, all 4 file targets confirmed on disk, blast radius contained (3 templates + email.py default). 7 AC items assessed as within 5-minute rule (homogeneous find-replace work). No decomposition needed. Ticket is ready for dispatch.
Author
Contributor

Agent picked up this ticket.

Agent picked up this ticket.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/basketball-api#344
No description provided.