Skip to content

Added member activity on gift redemption#27459

Merged
sagzy merged 1 commit intomainfrom
gift-subscriptions/member-activity-on-redemption
Apr 20, 2026
Merged

Added member activity on gift redemption#27459
sagzy merged 1 commit intomainfrom
gift-subscriptions/member-activity-on-redemption

Conversation

@sagzy
Copy link
Copy Markdown
Contributor

@sagzy sagzy commented Apr 20, 2026

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

  • adds a gift_redemption_event to the member activity feed so that when a member redeems a gift subscription, their timeline shows a dedicated entry:

🎁 Started paid subscription (Ultra) via gift

  • the existing gift_purchase_event also adopts the new gift icon so both sides of a gift read consistently in the buyer's and redeemer's member pages

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Walkthrough

This pull request adds support for a new gift_redemption_event event type throughout the Ghost admin members event system. Changes include updating icon and action display handling in the event parser, modifying event type toggle logic to treat redemption events alongside payment events, adding a new repository method to query and format gift redemption events from the Gift model with redeemer and tier relationships, and corresponding test coverage for the new event retrieval and filtering behavior.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Added member activity on gift redemption' directly summarizes the main change: introducing gift redemption event tracking in the member activity feed.
Description check ✅ Passed The description clearly explains the feature addition with a concrete example of the member activity output and notes the icon consistency update for gift purchases.

✏️ 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/member-activity-on-redemption

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.

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

- adds a `gift_redemption_event` to the member activity feed so that when a member redeems a gift subscription, their timeline shows a dedicated entry:

> **🎁 Started paid subscription (Ultra) via gift**

- the existing `gift_purchase_event` also adopts the new gift icon so both sides of a gift read consistently in the buyer's and redeemer's member pages
@sagzy sagzy force-pushed the gift-subscriptions/member-activity-on-redemption branch from 05e2cc3 to 9229f88 Compare April 20, 2026 07:38
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ghost/admin/app/helpers/parse-member-event.js`:
- Around line 276-279: The gift redemption branch uses event.data.tier_name
directly which can be undefined and produce "(undefined)" in the UI; update the
branch that handles event.type === 'gift_redemption_event' (where const tierName
= event.data.tier_name) to guard against missing/null values by using a fallback
string (e.g., "unknown tier" or omit the tier text) before constructing the
return message so the UI never shows "(undefined)". Ensure you reference the
existing symbol tierName (and the event.type === 'gift_redemption_event' branch)
when applying the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3e9cdcaf-f1fa-467e-9008-0f5850501a7a

📥 Commits

Reviewing files that changed from the base of the PR and between e7e19a5 and 9229f88.

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

Comment thread ghost/admin/app/helpers/parse-member-event.js
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 62.71186% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.38%. Comparing base (e7e19a5) to head (9229f88).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...mbers/members-api/repositories/event-repository.js 68.62% 16 Missing ⚠️
ghost/admin/app/helpers/parse-member-event.js 0.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #27459      +/-   ##
==========================================
- Coverage   73.39%   73.38%   -0.01%     
==========================================
  Files        1553     1553              
  Lines      125017   125074      +57     
  Branches    15094    15097       +3     
==========================================
+ Hits        91751    91783      +32     
- Misses      32242    32285      +43     
+ Partials     1024     1006      -18     
Flag Coverage Δ
admin-tests 54.27% <25.00%> (-0.04%) ⬇️
e2e-tests 73.38% <62.71%> (-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 merged commit e3e2124 into main Apr 20, 2026
44 of 45 checks passed
@sagzy sagzy deleted the gift-subscriptions/member-activity-on-redemption branch April 20, 2026 11:48
minimaluminium added a commit that referenced this pull request Apr 23, 2026
no issues

Follow-up tweaks to #27459:

- Scaled the gift event icon down so its footprint matches other event
icons, and nudged it up 1px for better optical centering
- Moved the tier name out of the action string into the info span so
gift redemptions render as `Started paid subscription via gift (Bronze)`
— matches the existing `subscription_event` pattern
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