Title: feat(billing): Convert referral bonuses from monthly recurring to one-time credits by brandonkachen · Pull Request #422 · CodebuffAI/codebuff · GitHub
Open Graph Title: feat(billing): Convert referral bonuses from monthly recurring to one-time credits by brandonkachen · Pull Request #422 · CodebuffAI/codebuff
X Title: feat(billing): Convert referral bonuses from monthly recurring to one-time credits by brandonkachen · Pull Request #422 · CodebuffAI/codebuff
Description: 📊 Impact: +71 / -75 lines (excluding tests and autogenerated files) Summary This PR changes the referral program from granting recurring monthly credits to one-time bonus credits that never expire. Existing (legacy) recurring referral bonuses are grandfathered and will continue to renew monthly. Changes Core Feature Referral grants are now one-time, non-expiring: New referral bonuses set expires_at: null instead of the user's next quota reset date Added is_legacy column: Tracks whether a referral grant is legacy (recurring monthly) or new (one-time) New referral_legacy grant type: Separate grant type for grandfathered recurring referrals with priority 30 (consumed first) Database migration: Adds the is_legacy column and referral_legacy enum value Grant Priority Changes referral_legacy (priority 30): Consumed first, renews monthly for grandfathered users referral (priority 50): One-time bonus, never expires, preserved longer UI Updates Profile referrals section now shows "per month" only for legacy referrals Legacy referrals display "(legacy)" label in the referral list Usage display shows "Referral Bonus (Legacy)" for recurring grants API Changes /api/referrals now returns is_legacy field redeemReferralCode creates grants with type: 'referral', expiresAt: null, is_legacy: false calculateTotalLegacyReferralBonus only counts referrals where is_legacy = true Files Changed common/src/types/grant.ts - Added referral_legacy grant type common/src/constants/grant-priorities.ts - Updated priorities packages/billing/src/grant-credits.ts - Use referral_legacy for monthly renewal packages/internal/src/db/schema.ts - Added is_legacy column web/src/app/api/referrals/helpers.ts - One-time grants with null expiry web/src/app/api/referrals/route.ts - Added is_legacy to response web/src/app/profile/components/referrals-section.tsx - Badge & label updates web/src/app/profile/components/usage-display.tsx - Added referral_legacy display
Open Graph Description: 📊 Impact: +71 / -75 lines (excluding tests and autogenerated files) Summary This PR changes the referral program from granting recurring monthly credits to one-time bonus credits that never expire....
X Description: 📊 Impact: +71 / -75 lines (excluding tests and autogenerated files) Summary This PR changes the referral program from granting recurring monthly credits to one-time bonus credits that never expire....
Opengraph URL: https://github.com/CodebuffAI/codebuff/pull/422
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:12a09b45-be02-952f-06d8-97e85cf37785 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A976:F9F81:9BD16F8:C95FD15:697EE073 |
| html-safe-nonce | ec2f25883c38ba2a88174d28d2348c81adf80a6e1b9e15e8107aa765881babb2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTc2OkY5RjgxOjlCRDE2Rjg6Qzk1RkQxNTo2OTdFRTA3MyIsInZpc2l0b3JfaWQiOiI1Mzk2MDExMTQ2NTM4ODM2MDgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 00b4513db39ef2826b3a6f3c3ccd7d35fc4736ee6d25f81812fbad5861e61761 |
| hovercard-subject-tag | pull_request:3212424627 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/CodebuffAI/codebuff/pull/422/files |
| twitter:image | https://avatars.githubusercontent.com/u/9735006?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/9735006?s=400&v=4 |
| og:image:alt | 📊 Impact: +71 / -75 lines (excluding tests and autogenerated files) Summary This PR changes the referral program from granting recurring monthly credits to one-time bonus credits that never expire.... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/CodebuffAI/codebuff git https://github.com/CodebuffAI/codebuff.git |
| octolytics-dimension-user_id | 189203002 |
| octolytics-dimension-user_login | CodebuffAI |
| octolytics-dimension-repository_id | 826515105 |
| octolytics-dimension-repository_nwo | CodebuffAI/codebuff |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 826515105 |
| octolytics-dimension-repository_network_root_nwo | CodebuffAI/codebuff |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width