Fixed paid messaging in Portal being shown to comped members#27440
Fixed paid messaging in Portal being shown to comped members#27440weylandswart wants to merge 1 commit intomainfrom
Conversation
Closes https://linear.app/ghost/issue/DES-1264/unsubscribe-modal-still-references-paid-subscription-for-free-users We used != free to control paid member messaging in Portal. This inadvertently included comped members (Not free). They'd then confusingly see messaging about a paid subscription which they don't have.
WalkthroughThis change refines how paid membership status is determined across the portal's newsletter management components. In 🚥 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.
🧹 Nitpick comments (1)
apps/portal/src/components/pages/unsubscribe-page.js (1)
269-269: Consider aligning withaccount-email-page.jsusing the shared helpers.The fix is correct —
member?.status === 'paid'excludes'comped'members and resolves the bug. However, the siblingaccount-email-page.jsusesisPaidMember({member}) && !isComplimentaryMember({member}), which relies on the helpers inutils/helpers.js. Using the same idiom in both places keeps the "is this member paid for messaging purposes?" logic consistent and easier to evolve (e.g., if additional statuses like trialing are ever added, or if thestatusfield is ever missing whilepaid/subscription data is present).♻️ Optional: use helpers for consistency
-import {getSiteNewsletters,hasNewsletterSendingEnabled} from '../../utils/helpers'; +import {getSiteNewsletters, hasNewsletterSendingEnabled, isPaidMember, isComplimentaryMember} from '../../utils/helpers'; @@ - isPaidMember={member?.status === 'paid'} + isPaidMember={isPaidMember({member}) && !isComplimentaryMember({member})}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/portal/src/components/pages/unsubscribe-page.js` at line 269, Replace the inline check isPaidMember={member?.status === 'paid'} with the shared helper usage used in account-email-page.js: call isPaidMember({member}) and also ensure complimentary members are excluded by && !isComplimentaryMember({member}); import these helpers from utils/helpers.js if not already imported so the component uses the same helper-based logic as account-email-page.js.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/portal/src/components/pages/unsubscribe-page.js`:
- Line 269: Replace the inline check isPaidMember={member?.status === 'paid'}
with the shared helper usage used in account-email-page.js: call
isPaidMember({member}) and also ensure complimentary members are excluded by &&
!isComplimentaryMember({member}); import these helpers from utils/helpers.js if
not already imported so the component uses the same helper-based logic as
account-email-page.js.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0ed1380c-6580-47c0-9412-e1883e3d5285
📒 Files selected for processing (2)
apps/portal/src/components/pages/account-email-page.jsapps/portal/src/components/pages/unsubscribe-page.js



Closes https://linear.app/ghost/issue/DES-1264/unsubscribe-modal-still-references-paid-subscription-for-free-users
We used != free to control paid member messaging in Portal. This inadvertently included comped members (Not free). They'd then confusingly see messaging about a paid subscription which they don't have.