feat(deleter): email the org owners when a delete forfeits tokens - #1880
feat(deleter): email the org owners when a delete forfeits tokens#1880whoAbhishekSah wants to merge 1 commit into
Conversation
Deleting an organization forfeits any unused tokens. The owners now get an email saying how many tokens were left and that support can transfer the amount. The subject and body come from the billing config (billing.token_forfeit_notice.subject/body) as Go templates with .Amount, .Org, and .User, falling back to plain built-in text — the same pattern the PAT expiry alerts use. The mail goes through the shared mailer dialer, only after the delete fully succeeded, and a send failure is logged, never returned. The owners and the amount are read before teardown (they are gone after). The org lookup at the start switched from Get to GetRaw so a disabled org keeps its title in the email and stays deletable without a special case.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for CI Build 31695140194Coverage increased (+0.07%) to 48.428%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Part of #1837. Top of the stack, based on #1857.
Deleting an organization forfeits any unused tokens (the client confirms that with the user before calling). This PR adds the second half of that flow: the org owners get an email saying how many tokens were left and that support can transfer the amount to their bank account.
How it works:
billing.token_forfeit_notice.subjectandbilling.token_forfeit_notice.body. Both are Go templates with.Amount(tokens forfeited),.Org(the deleted organization), and.User(the owner receiving the mail). Empty config falls back to plain built-in text. This is the same pattern the PAT expiry alert emails use.app.mailerdialer to every user holding the org owner role.not_foundbefore any of this runs, so nobody gets the mail twice.Side change: the org lookup at the start of the delete switched from
GettoGetRaw, so a disabled org keeps its title for the email and stays deletable without theErrDisabledspecial case.🤖 Generated with Claude Code