Updated copy for gift subscriptions events in member activity feed#27771
Updated copy for gift subscriptions events in member activity feed#27771
Conversation
- gift redemption now reads "Started gift subscription" with the gift icon - gift expiration reads "Gift subscription expired" with a new stroked-gift icon, mirroring how the dollar icon is stroked for cancelled paid subscriptions - removed the "continued paid subscription after gift" override; gifted members upgrading to paid now show the standard "Started paid subscription" event - dropped the now-unused previous_status field and its eager-load of paidStatusEvent in the subscription event repository
WalkthroughThis PR updates gift-related event handling: the backend removes previous_status from subscription_event payloads; the admin parse-member-event helper now maps gift_ended_event to an expired-gift icon and changes gift_redemption_event and gift_ended_event action text to "started gift subscription" and "gift subscription expired" respectively. Unit tests in admin and core were updated to match these display changes, the getSubscriptionEvents unit test block was removed, and an e2e test header snapshot now includes content-length. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
🧹 Nitpick comments (1)
ghost/admin/tests/unit/helpers/parse-member-event-test.js (1)
33-40: ⚡ Quick winAdd one explicit regression case for legacy
previous_status.Consider adding a created
subscription_eventfixture withdata.previous_status = 'gift'and asserting it still returns"started paid subscription". This locks in the removal of legacy override behavior even if that field reappears in older payloads.Suggested test addition
describe('subscription_event action', function () { it('returns "started paid subscription" for a created subscription_event', function () { const event = buildEvent({ type: 'subscription_event', data: {type: 'created'} }); const result = helper.compute([event]); expect(result.action).to.equal('started paid subscription'); }); + + it('ignores previous_status="gift" and still returns "started paid subscription"', function () { + const event = buildEvent({ + type: 'subscription_event', + data: {type: 'created', previous_status: 'gift'} + }); + const result = helper.compute([event]); + expect(result.action).to.equal('started paid subscription'); + }); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ghost/admin/tests/unit/helpers/parse-member-event-test.js` around lines 33 - 40, Add a regression unit test in parse-member-event-test.js that constructs a subscription_event using buildEvent with data.type set to 'created' and data.previous_status set to 'gift', call helper.compute([event]) and assert the returned result.action equals 'started paid subscription' to ensure legacy previous_status does not override the created-subscription behavior; place this alongside the existing created subscription test so it covers the legacy payload case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@ghost/admin/tests/unit/helpers/parse-member-event-test.js`:
- Around line 33-40: Add a regression unit test in parse-member-event-test.js
that constructs a subscription_event using buildEvent with data.type set to
'created' and data.previous_status set to 'gift', call helper.compute([event])
and assert the returned result.action equals 'started paid subscription' to
ensure legacy previous_status does not override the created-subscription
behavior; place this alongside the existing created subscription test so it
covers the legacy payload case.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2a41a726-df99-4171-9e62-4a88e83eafeb
⛔ Files ignored due to path filters (1)
ghost/admin/public/assets/icons/event-expired-gift.svgis excluded by!**/*.svg
📒 Files selected for processing (4)
ghost/admin/app/helpers/parse-member-event.jsghost/admin/tests/unit/helpers/parse-member-event-test.jsghost/core/core/server/services/members/members-api/repositories/event-repository.jsghost/core/test/unit/server/services/members/members-api/repositories/event-repository.test.js
💤 Files with no reviewable changes (2)
- ghost/core/core/server/services/members/members-api/repositories/event-repository.js
- ghost/core/test/unit/server/services/members/members-api/repositories/event-repository.test.js
5478c88 to
ddbc656
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27771 +/- ##
=======================================
Coverage 73.77% 73.77%
=======================================
Files 1511 1511
Lines 125702 125693 -9
Branches 15127 15121 -6
=======================================
- Hits 92731 92726 -5
+ Misses 32027 32026 -1
+ Partials 944 941 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
closes https://linear.app/ghost/issue/BER-3617
We're updating the copy used for member activity events during the gift subscription lifecycle:
gift_redemption_event)gift_ended_event)subscription_event)Changes
New icon
A new
event-expired-gift.svgicon mirrors the pattern used byevent-canceled-subscription.svg— gift body in grey with a red#F50B23diagonal slash overlay.Backend cleanup (event-repository.js)
The
previous_statusfield onsubscription_eventpayloads existed solely to drive the "continued after gift" override. With that gone, the entire pipeline is removed:subscriptionCreatedEvent.paidStatusEventfromwithRelatedingetSubscriptionEvents.paidStatusEvent/previousStatusderivation, theprevious_statusfield on the response, and the relateddelete d.subscriptionCreatedEvent?.paidStatusEventcleanup.The
paidStatusEventrelation on thesubscription-created-eventmodel is left in place for future use.Verification
pnpm test:singleforevent-repository.test.js— 32/32 passingember test --filter \"parse-member-event\"— 10/10 passingpnpm lint:jsclean (admin)pnpm dev: redeem a gift → expire → upgrade to paid, confirm the three labels and the new icon render correctly. Worth a visual check on the red slash placement on the gift icon — the SVG endpoints can be nudged if it doesn't look balanced next to the canceled-subscription icon.