Skip to content

Updated copy for gift subscriptions events in member activity feed#27771

Merged
sagzy merged 2 commits intomainfrom
gift-subscriptions/update-member-activity
May 7, 2026
Merged

Updated copy for gift subscriptions events in member activity feed#27771
sagzy merged 2 commits intomainfrom
gift-subscriptions/update-member-activity

Conversation

@sagzy
Copy link
Copy Markdown
Contributor

@sagzy sagzy commented May 7, 2026

closes https://linear.app/ghost/issue/BER-3617

We're updating the copy used for member activity events during the gift subscription lifecycle:

Event Before After
Member redeems gift (gift_redemption_event) 🎁 Started paid subscription via gift 🎁 Started gift subscription
Gift subscription expires (gift_ended_event) $ Ended paid subscription 🎁 (strike-through) Gift subscription expired
Gift member continues to paid sub (subscription_event) $ Continued paid subscription after gift $ Started paid subscription

Changes

New icon

A new event-expired-gift.svg icon mirrors the pattern used by event-canceled-subscription.svg — gift body in grey with a red #F50B23 diagonal slash overlay.

Backend cleanup (event-repository.js)

The previous_status field on subscription_event payloads existed solely to drive the "continued after gift" override. With that gone, the entire pipeline is removed:

  • Dropped subscriptionCreatedEvent.paidStatusEvent from withRelated in getSubscriptionEvents.
  • Removed the paidStatusEvent / previousStatus derivation, the previous_status field on the response, and the related delete d.subscriptionCreatedEvent?.paidStatusEvent cleanup.

The paidStatusEvent relation on the subscription-created-event model is left in place for future use.

Verification

  • pnpm test:single for event-repository.test.js — 32/32 passing
  • ember test --filter \"parse-member-event\" — 10/10 passing
  • pnpm lint:js clean (admin)
  • Manual smoke test in 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.

- 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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

Walkthrough

This 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

  • TryGhost/Ghost#27649: Modifies parse-member-event.js with related icon/action mappings for gift_ended_event.
  • TryGhost/Ghost#27524: Also adjusts admin helper handling of gift-related member events and display text/icons.

Suggested reviewers

  • mike182uk
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title 'Updated copy for gift subscriptions events in member activity feed' directly and clearly summarizes the main change: updating user-facing text for gift subscription-related events in the member activity feed.
Description check ✅ Passed The pull request description clearly explains the updates to gift subscription event copy and icons, details the backend cleanup in event-repository.js, and provides verification results.

✏️ 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 gift-subscriptions/update-member-activity

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.

❤️ Share

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

@sagzy sagzy changed the title 🎨 Improved gift subscription events in member activity feed Improved gift subscription events in member activity feed May 7, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
ghost/admin/tests/unit/helpers/parse-member-event-test.js (1)

33-40: ⚡ Quick win

Add one explicit regression case for legacy previous_status.

Consider adding a created subscription_event fixture with data.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

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd3f89 and 7e6949e.

⛔ Files ignored due to path filters (1)
  • ghost/admin/public/assets/icons/event-expired-gift.svg is excluded by !**/*.svg
📒 Files selected for processing (4)
  • ghost/admin/app/helpers/parse-member-event.js
  • ghost/admin/tests/unit/helpers/parse-member-event-test.js
  • 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
💤 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

@sagzy sagzy force-pushed the gift-subscriptions/update-member-activity branch from 5478c88 to ddbc656 Compare May 7, 2026 14:17
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.77%. Comparing base (1dd3f89) to head (ddbc656).
⚠️ Report is 5 commits behind head on main.

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     
Flag Coverage Δ
admin-tests 53.14% <100.00%> (+0.03%) ⬆️
e2e-tests 73.77% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sagzy sagzy changed the title Improved gift subscription events in member activity feed Updated copy for gift subscriptions events in member activity feed May 7, 2026
@sagzy sagzy merged commit 905f523 into main May 7, 2026
45 checks passed
@sagzy sagzy deleted the gift-subscriptions/update-member-activity branch May 7, 2026 18:46
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.

2 participants