Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (5)
WalkthroughThis PR consolidates gift subscription email notifications under a unified "gift-subscriptions" alert type in the User model, updates StaffServiceEmails methods to request recipients with that key and to use "Gift subscription redeemed" subject wording, refreshes staff email templates (HTML and text) to use redeemed/purchase-consistent phrasing, updates the admin UI toggle label/hint for gift subscriptions, and aligns unit and e2e tests to the new recipient key and subjects. 🚥 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/core/core/server/models/user.js (1)
494-497: 💤 Low valueUpdate stale JSDoc type union for
getEmailAlertUsers.The
@paramtype union lists only 3 of the 8 values the function now handles. This PR adds'gift-subscriptions'as yet another unrecorded entry.📝 Proposed JSDoc fix
-* `@param` {'free-signup'|'paid-started'|'paid-canceled'} type The type of alert to fetch users for +* `@param` {'free-signup'|'paid-started'|'paid-canceled'|'mention-received'|'milestone-received'|'donation'|'recommendation-received'|'gift-subscriptions'} type The type of alert to fetch users for🤖 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/core/core/server/models/user.js` around lines 494 - 497, Update the JSDoc for getEmailAlertUsers to reflect the full set of alert type string literals the function actually handles (including 'gift-subscriptions' and the other values present in the function's logic) by expanding the `@param` union to include all eight accepted types; ensure the documented union matches the switch/if branches inside getEmailAlertUsers so the JSDoc accurately describes allowed inputs and update any related return/description if necessary.
🤖 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/core/core/server/models/user.js`:
- Around line 494-497: Update the JSDoc for getEmailAlertUsers to reflect the
full set of alert type string literals the function actually handles (including
'gift-subscriptions' and the other values present in the function's logic) by
expanding the `@param` union to include all eight accepted types; ensure the
documented union matches the switch/if branches inside getEmailAlertUsers so the
JSDoc accurately describes allowed inputs and update any related
return/description if necessary.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f10b7155-2dba-493d-a302-179219862446
📒 Files selected for processing (6)
apps/admin-x-settings/src/components/settings/general/users/email-notifications-tab.tsxghost/core/core/server/models/user.jsghost/core/core/server/services/staff/email-templates/new-gift-subscription.hbsghost/core/core/server/services/staff/email-templates/new-gift-subscription.txt.jsghost/core/core/server/services/staff/staff-service-emails.jsghost/core/test/unit/server/services/staff/staff-service.test.js
9e5b07a to
7cccb78
Compare
- Subject and headline now say "Gift subscription redeemed" instead of "Paid subscription started" / "new paid subscriber", so the email reads as a gift event rather than a generic paid signup - Routed the redemption notification through the existing "Gift subscriptions" preference (relabelled from "Gift subscription purchases", description updated to "Every time someone purchases or redeems a gift subscription") so all gift notifications sit behind one toggle, instead of redemptions piggybacking on "New paid members" - Renamed alert type 'gift-subscription-purchased' → 'gift-subscriptions' to match the new grouping; DB column gift_subscription_purchase_notification is unchanged, so no migration is required - Added a secretlint-disable-next-line for the random password generator default in user.js — the secretlint pattern flags `password: fn(...)` as a credential assignment false-positive Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
7cccb78 to
0e554dc
Compare
closes https://linear.app/ghost/issue/BER-3616
When a recipient redeems a gift subscription, Ghost sends staff a notification email. Today it reuses the paid subscription started copy and the New paid members email-preference toggle.
We've decided to differentiate the gift redemption staff notification more clearly from the new paid members one. This PR changes the copy of the gift redemption staff notification and moves it under the "Gift subscriptions" email-preference toggle.
Changes
Email copy —
notifyGiftSubscriptionStarted:🎁 Paid subscription started: <name>→🎁 Gift subscription redeemed: <name>You have a new paid subscriber→A gift subscription was redeemedNotification preference — gift redemptions now go through the existing Gift subscriptions toggle (Stripe +
giftSubscriptionsfeature flag), instead of New paid members:Gift subscription purchases→Gift subscriptionsEvery time someone purchases a gift subscription→Every time someone purchases or redeems a gift subscriptionPre-commit hygiene:
secretlint-disable-next-lineon the random-password-generator default inuser.js— the new secret-scanning hook (added in Added secret scanning pre-commit hook #27609) flagspassword: security.identifier.uid(50)as a credential-assignment false-positive, blocking any future change to this file. The line generates a random password placeholder; it isn't a real credential.