Skip to content

Fixed cancelled subscriptions counting in multiple subscriptions warning#28507

Merged
kevinansfield merged 1 commit into
mainfrom
fix-multiple-active-subscriptions-filter-cancelling
Jun 11, 2026
Merged

Fixed cancelled subscriptions counting in multiple subscriptions warning#28507
kevinansfield merged 1 commit into
mainfrom
fix-multiple-active-subscriptions-filter-cancelling

Conversation

@kevinansfield

@kevinansfield kevinansfield commented Jun 11, 2026

Copy link
Copy Markdown
Member

ref https://linear.app/ghost/issue/BER-3722/

The multiple-active-subscriptions members filter added in #28232 was returning too many members. Stripe keeps a cancelled subscription's status as active until the end of its billing period, so after a site owner contacted affected members and the extra subscriptions were cancelled, those members kept showing in the filter and the warning banner until their billing periods ended — making it look like the problem hadn't been resolved.

The filter's subquery now also requires cancel_at_period_end to be false, so a subscription that's running out its term after cancellation no longer counts as active. Cancelling an extra subscription immediately removes the member from the filter and the banner count.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f490b2fb-40f5-43f2-8981-365ae8d43e27

📥 Commits

Reviewing files that changed from the base of the PR and between 9d6eb28 and 552282b.

📒 Files selected for processing (2)
  • ghost/core/core/server/models/member.js
  • ghost/core/test/e2e-api/admin/members.test.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • ghost/core/core/server/models/member.js
  • ghost/core/test/e2e-api/admin/members.test.js

Walkthrough

This PR modifies how Ghost counts "active" Stripe customers by filtering subscriptions to exclude those marked for cancellation at period end. The core change adds a cancel_at_period_end = false filter to the activeStripeCustomersCount query in the Member model. Supporting test updates refactor the Stripe subscription helper to accept configuration options and expand test coverage with trialing and cancelling subscription scenarios.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main fix: preventing cancelled subscriptions (those with cancel_at_period_end=true) from being counted in the active subscriptions filter.
Description check ✅ Passed The description clearly explains the problem, root cause, and solution related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-multiple-active-subscriptions-filter-cancelling

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.43.0)
ghost/core/test/e2e-api/admin/members.test.js

Comment @coderabbitai help to get the list of available commands and usage tips.

ref https://linear.app/ghost/issue/BER-3722/

- Stripe keeps a cancelled subscription's status as "active" until the end of its billing period, so members stayed in the multiple-active-subscriptions filter and warning banner even after their extra subscriptions had been cancelled
- the filter now also requires cancel_at_period_end to be false, so cancelling an extra subscription immediately removes the member from the filter and banner count
@kevinansfield kevinansfield force-pushed the fix-multiple-active-subscriptions-filter-cancelling branch from 9d6eb28 to 552282b Compare June 11, 2026 14:03
@kevinansfield kevinansfield changed the title 🐛 Fixed cancelled subscriptions counting in multiple subscriptions warning Fixed cancelled subscriptions counting in multiple subscriptions warning Jun 11, 2026
@kevinansfield kevinansfield enabled auto-merge (rebase) June 11, 2026 14:10
@kevinansfield kevinansfield merged commit c1a6b6c into main Jun 11, 2026
49 checks passed
@kevinansfield kevinansfield deleted the fix-multiple-active-subscriptions-filter-cancelling branch June 11, 2026 14:24
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