Added gift subscription label in Admin member page#27393
Conversation
WalkthroughThe changes add explicit handling for gift subscriptions across UI, utilities, and tests. 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb777c2aa2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }, | ||
| isComplimentary: isComplimentary(sub), | ||
| compExpiry: compExpiry(sub), | ||
| isGift: isGiftSubscription(memberStatus), |
There was a problem hiding this comment.
Determine gift state per subscription
isGift is currently derived from the member’s global status, so when a member with historical canceled Stripe subscriptions later redeems a gift (status becomes gift), all subscription rows are treated as gift subscriptions. The member page still renders historical canceled subscriptions, so those past paid rows will be mislabeled as “Gift subscription”, lose their normal validity text, and skip the regular action menu. This should be computed from the individual subscription record instead of memberStatus to avoid misclassifying non-gift subscriptions on gift members.
Useful? React with 👍 / 👎.
cb777c2 to
3a98b6e
Compare
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ghost/admin/tests/unit/utils/subscription-data-test.js (1)
256-262: Test confirms gift subscription validity details format.Consider adding a test for gift subscriptions without
giftExpiry(should return'') for symmetry with the complimentary "forever" test at lines 248-254.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ghost/admin/tests/unit/utils/subscription-data-test.js` around lines 256 - 262, Add a unit test that verifies validityDetails returns an empty string for gift subscriptions when giftExpiry is missing: create a test case similar to the existing gift test but set isGift: true and omit giftExpiry (or set it undefined/null) and assert validityDetails(data) === ''. Update or add the test near the other validityDetails tests so it mirrors the complimentary "forever" case and references the validityDetails helper used in the current tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ghost/admin/tests/unit/utils/subscription-data-test.js`:
- Around line 256-262: Add a unit test that verifies validityDetails returns an
empty string for gift subscriptions when giftExpiry is missing: create a test
case similar to the existing gift test but set isGift: true and omit giftExpiry
(or set it undefined/null) and assert validityDetails(data) === ''. Update or
add the test near the other validityDetails tests so it mirrors the
complimentary "forever" case and references the validityDetails helper used in
the current tests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a9fbc5cb-2ae8-4182-a5a3-3071fd155fcb
📒 Files selected for processing (5)
ghost/admin/app/components/gh-member-settings-form.hbsghost/admin/app/components/gh-member-settings-form.jsghost/admin/app/utils/subscription-data.jsghost/admin/tests/acceptance/members/details-test.jsghost/admin/tests/unit/utils/subscription-data-test.js
🚧 Files skipped from review as they are similar to previous changes (3)
- ghost/admin/app/components/gh-member-settings-form.hbs
- ghost/admin/app/components/gh-member-settings-form.js
- ghost/admin/tests/acceptance/members/details-test.js
|
As the Admin page shows a history of subscriptions, this is not going to be sufficient. Closing for another solution |



closes https://linear.app/ghost/issue/BER-3482
Summary
Update the Admin member details page to treat gift subscriptions as a distinct subscription type instead of displaying them as complimentary subscriptions.
For gift subscriptions, we now display:
Gift subscription – Expires {date}with no action menu to remove the subscription:
What changed
giftExpiryhelper sourced fromsub.tier.expiry_atGift subscriptionExpires {date}ComplimentaryRemove complimentary subscriptionactionisComplimentaryso it only applies tocompedmembers with manual subscriptions