codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

feat(billing): polish the add-ons page after the first review #184

Merged
pat-s merged 1 commit from feat/billing-page-feedback into v16.0/forgejo-codefloe 2026-09-30 09:29:28 +00:00
Owner

Address the first round of feedback on the Creem add-ons page from #180.

Changes

  • templates/shared/codefloe_billing.tmpl: put the price on its own line instead of joining it with " · ", keep the quantity field 5rem wide on one row with its label and the Buy button, add a Billing section at the top with one "Manage billing" button, show named quota rows instead of <code>size:repos:all</code>, and add a theme field to the checkout forms.
  • templates/shared/codefloe_billing_list.tmpl: drop the per-add-on "Manage billing" button; other owners of an organisation still see "Billed to ".
  • routers/web/shared/codefloe_billing.go: say "Each unit adds 10 GiB of storage" for storage and "adds 1000 minutes per month" for CI time, name each limit row, show the Billing section to anyone who ever bought an add-on, and append ?theme=light|dark to the Creem checkout URL when the form reports it.
  • routers/web/shared/codefloe_quota_ci.go: prettyLimitSubject names any limit subject, mirroring the upstream storage overview's closure, which stays untouched.
  • services/codefloe/billing/catalog.go: write whole prices without cents ("5 EUR"), others with them ("5.50 EUR").
  • services/codefloe/billing/actions.go, models/codefloe/billing/addon.go: PortalLink(ctx, doer) opens the doer's own Creem customer portal, found from the newest add-on they paid for (any owner, any status). ErrNotBuyer becomes ErrNoCustomer.
  • routers/web/web.go: POST .../settings/addons/{id}/portal becomes POST .../settings/addons/portal for users and organisations.
  • web_src/js/codefloe/billing-checkout.js: fill the checkout form's theme on submit from isDarkTheme(), so an automatic theme follows the browser.
  • options/locale_next/locale_en-US.json: new and reworded strings.
  • README.md: update the "Billing add-ons" row.
  • models/quota/addon_codefloe_test.go, custom/conf/app.example.ini: test and document a shared asset pool, a product naming size:assets:all plus the subjects under it. It raises the pool rule, which bounds the total, and each per-type cap, so a 5 GiB pack can go to packages, attachments or artifacts in any mix. No code is needed for it.
  • Tests: unit, integration and e2e updated for the page-level portal, named rows, the dot-free price line and the theme redirect; test product names capitalise "Git".

Behaviour change

  • The Creem customer portal covers every subscription of the buyer's Creem customer, so one button replaces one per add-on. It still opens only the signed-in user's own portal: an organisation owner who did not pay gets no button and a refusal if they post anyway.
  • The checkout opens light or dark to match the page. Creem's logo and accent colours are store settings in its dashboard (Settings → Branding) with no API, so they are not set here.

Not in this PR

The product line-up and prices live in the infrastructure repository and Creem: IaC #297 now sells git-2g (2 GiB Git storage, EUR 1.00) and assets-5g (5 GiB asset storage as a shared pool, EUR 1.00) next to ci-1000 on dev.

Validation

  • go test for models/codefloe/billing, services/codefloe/billing and services/codefloe/quota_storage pass.
  • Integration on SQLite: TestBilling|TestAPIQuota|TestQuota|TestActionsQuotaCI|TestCodefloe (284 tests, 19 of them TestBilling*) pass.
  • Playwright codefloe-billing.test.e2e.ts passes in Chromium, Firefox and Mobile Chrome.
  • vitest for billing-checkout.test.js passes; make lint-go on the pinned go1.26.7 and prek run -a pass.
Address the first round of feedback on the Creem add-ons page from #180. ## Changes - `templates/shared/codefloe_billing.tmpl`: put the price on its own line instead of joining it with " · ", keep the quantity field 5rem wide on one row with its label and the Buy button, add a Billing section at the top with one "Manage billing" button, show named quota rows instead of `<code>size:repos:all</code>`, and add a `theme` field to the checkout forms. - `templates/shared/codefloe_billing_list.tmpl`: drop the per-add-on "Manage billing" button; other owners of an organisation still see "Billed to <buyer>". - `routers/web/shared/codefloe_billing.go`: say "Each unit adds 10 GiB of storage" for storage and "adds 1000 minutes per month" for CI time, name each limit row, show the Billing section to anyone who ever bought an add-on, and append `?theme=light|dark` to the Creem checkout URL when the form reports it. - `routers/web/shared/codefloe_quota_ci.go`: `prettyLimitSubject` names any limit subject, mirroring the upstream storage overview's closure, which stays untouched. - `services/codefloe/billing/catalog.go`: write whole prices without cents ("5 EUR"), others with them ("5.50 EUR"). - `services/codefloe/billing/actions.go`, `models/codefloe/billing/addon.go`: `PortalLink(ctx, doer)` opens the doer's own Creem customer portal, found from the newest add-on they paid for (any owner, any status). `ErrNotBuyer` becomes `ErrNoCustomer`. - `routers/web/web.go`: `POST .../settings/addons/{id}/portal` becomes `POST .../settings/addons/portal` for users and organisations. - `web_src/js/codefloe/billing-checkout.js`: fill the checkout form's `theme` on submit from `isDarkTheme()`, so an automatic theme follows the browser. - `options/locale_next/locale_en-US.json`: new and reworded strings. - `README.md`: update the "Billing add-ons" row. - `models/quota/addon_codefloe_test.go`, `custom/conf/app.example.ini`: test and document a shared asset pool, a product naming `size:assets:all` plus the subjects under it. It raises the pool rule, which bounds the total, and each per-type cap, so a 5 GiB pack can go to packages, attachments or artifacts in any mix. No code is needed for it. - Tests: unit, integration and e2e updated for the page-level portal, named rows, the dot-free price line and the theme redirect; test product names capitalise "Git". ## Behaviour change - The Creem customer portal covers every subscription of the buyer's Creem customer, so one button replaces one per add-on. It still opens only the signed-in user's own portal: an organisation owner who did not pay gets no button and a refusal if they post anyway. - The checkout opens light or dark to match the page. Creem's logo and accent colours are store settings in its dashboard (Settings → Branding) with no API, so they are not set here. ## Not in this PR The product line-up and prices live in the infrastructure repository and Creem: [IaC #297](https://codefloe.com/codefloe/infrastructure-as-code/pulls/297) now sells `git-2g` (2 GiB Git storage, EUR 1.00) and `assets-5g` (5 GiB asset storage as a shared pool, EUR 1.00) next to `ci-1000` on dev. ## Validation - `go test` for `models/codefloe/billing`, `services/codefloe/billing` and `services/codefloe/quota_storage` pass. - Integration on SQLite: `TestBilling|TestAPIQuota|TestQuota|TestActionsQuotaCI|TestCodefloe` (284 tests, 19 of them `TestBilling*`) pass. - Playwright `codefloe-billing.test.e2e.ts` passes in Chromium, Firefox and Mobile Chrome. - `vitest` for `billing-checkout.test.js` passes; `make lint-go` on the pinned go1.26.7 and `prek run -a` pass.
pat-s force-pushed feat/billing-page-feedback from 181bcbbc72
Some checks failed
testing / frontend-checks (pull_request) Successful in 1m45s
testing / backend-checks (pull_request) Successful in 5m25s
testing / test-remote-cacher (valkey) (pull_request) Successful in 3m39s
testing / test-sqlite (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Successful in 3m38s
testing / test-remote-cacher (garnet) (pull_request) Successful in 3m22s
testing / test-unit (pull_request) Successful in 11m51s
testing / test-mysql (pull_request) Has been cancelled
testing / test-pgsql (pull_request) Has been cancelled
to a882303404
Some checks failed
testing / frontend-checks (pull_request) Successful in 1m39s
testing / backend-checks (pull_request) Successful in 7m5s
testing / test-pgsql (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-unit (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Has been cancelled
testing / test-remote-cacher (valkey) (pull_request) Has been cancelled
testing / test-remote-cacher (garnet) (pull_request) Has been cancelled
testing / test-mysql (pull_request) Has been cancelled
testing / test-sqlite (pull_request) Has been cancelled
2026-09-30 07:53:58 +00:00
Compare
pat-s force-pushed feat/billing-page-feedback from a882303404
Some checks failed
testing / frontend-checks (pull_request) Successful in 1m39s
testing / backend-checks (pull_request) Successful in 7m5s
testing / test-pgsql (pull_request) Has been cancelled
testing / test-e2e (pull_request) Has been cancelled
testing / test-unit (pull_request) Has been cancelled
testing / test-remote-cacher (redis) (pull_request) Has been cancelled
testing / test-remote-cacher (valkey) (pull_request) Has been cancelled
testing / test-remote-cacher (garnet) (pull_request) Has been cancelled
testing / test-mysql (pull_request) Has been cancelled
testing / test-sqlite (pull_request) Has been cancelled
to d54f481929
All checks were successful
testing / frontend-checks (pull_request) Successful in 1m45s
testing / backend-checks (pull_request) Successful in 6m4s
testing / test-remote-cacher (garnet) (pull_request) Successful in 2m8s
testing / test-unit (pull_request) Successful in 12m8s
testing / test-remote-cacher (valkey) (pull_request) Successful in 2m53s
testing / test-remote-cacher (redis) (pull_request) Successful in 2m53s
testing / test-mysql (pull_request) Successful in 33m50s
testing / test-e2e (pull_request) Successful in 32m47s
testing / test-sqlite (pull_request) Successful in 50m23s
testing / test-pgsql (pull_request) Successful in 54m23s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
2026-09-30 08:04:45 +00:00
Compare
pat-s merged commit a1b173a67f into v16.0/forgejo-codefloe 2026-09-30 09:29:28 +00:00
pat-s deleted branch feat/billing-page-feedback 2026-09-30 09:29:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
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
codefloe/forgejo-codefloe!184
No description provided.