Skip to content

Let staff email a listing's maintainers its badges - #50

Merged
mykolamelnykml merged 1 commit into
mainfrom
badge-suggestion-email
Oct 8, 2026
Merged

mykolamelnykml merged 1 commit into
mainfrom
badge-suggestion-email

Conversation

@mykolamelnykml

Copy link
Copy Markdown
Contributor

Why

Maintainers can embed a Redaction Tools badge (Listed, Reviewed, Benchmarked) from /my-listings, but nothing tells them it exists. Staff want to suggest it from the tool page.

What

  • Staff record lists maintainers. StaffToolOut.maintainers: the work email of every approved claim on an active account, the same rule as the public "vendor-maintained" mark.
  • Staff panel button. "Email badge suggestion" appears only when the listing has maintainers, next to their addresses, and reports "Badge suggestion sent to …" afterwards.
  • Route and service. POST /api/v1/catalog/staff/tools/{slug}/badge-suggestion, backed by staff.send_badge_suggestion (the write goes through staff.py, like every other staff write). It queues one badge_suggestion email per maintainer on commit: separate messages hide addresses from each other, and a retry cannot resend a sibling. A listing with no maintainers gets a 422 StaffError.
  • The email shows the three badges, each with a line on what it claims, explains that a badge greys out when its claim lapses, and has a "Get your badge" button to /my-listings.
  • PNG badges for email. Gmail and Outlook don't render SVG, so frontend/public/images/email/badge-{listed,reviewed,benchmarked}.png are 2x renders of renderBadge (earned, light theme). DEVELOPMENT.md notes they need re-rendering if the badge design changes.

make schema and make backend-emails regenerated the contract and the HTML.

Tests

  • Backend: maintainers exclude pending claims and inactive accounts; one email per maintainer, with the /my-listings link and all three badge images; refused with no maintainers; staff route sends; an owner gets 403.
  • Frontend: no button without maintainers; with them, the panel shows the address, POSTs to the route and confirms who it went to.
  • Locally: backend 732 passed, frontend 920 passed, lint and typecheck clean, schema and emails not stale.

Owners can embed a Listed, Reviewed or Benchmarked badge from /my-listings,
but nothing told them so. Staff can now send that suggestion from the tool
page.

- The staff record carries `maintainers`: the work email of every approved
  claim on an active account, the rule behind "vendor-maintained". The staff
  panel lists them and, only then, shows "Email badge suggestion".
- `POST /catalog/staff/tools/{slug}/badge-suggestion` calls
  `staff.send_badge_suggestion`, which queues one `badge_suggestion` email
  per maintainer on commit, so no one sees another's address and a retry
  cannot resend a sibling. A listing nobody maintains is refused (422).
- The email shows all three badges with what each claims and links to
  /my-listings. Mail clients do not render SVG, so it uses fixed PNGs in
  public/images/email/, rendered from svg.ts (earned, light theme).
- DEVELOPMENT.md: the email table and the owner-badges section.
@mykolamelnykml
mykolamelnykml merged commit ff2d460 into main Oct 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant