Skip to content

Fixed paid messaging in Portal being shown to comped members#27440

Open
weylandswart wants to merge 1 commit intomainfrom
fixing-comped-member-state-when-unsubscribing
Open

Fixed paid messaging in Portal being shown to comped members#27440
weylandswart wants to merge 1 commit intomainfrom
fixing-comped-member-state-when-unsubscribing

Conversation

@weylandswart
Copy link
Copy Markdown
Contributor

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.

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

coderabbitai bot commented Apr 16, 2026

Walkthrough

This change refines how paid membership status is determined across the portal's newsletter management components. In account-email-page.js, the isPaidMember prop now excludes complimentary members by adding an additional check. In unsubscribe-page.js, the logic shifts from a negation check (status !== 'free') to an explicit status check (status === 'paid'). These modifications make the membership classification more precise by treating paid and complimentary members distinctly and clarifying the conditions under which members are considered paid for newsletter management purposes.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 clearly and specifically describes the main change: fixing paid messaging being shown to comped members, which directly aligns with the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the root cause (using != free) and the fix (excluding comped members from paid member treatment).

✏️ 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 fixing-comped-member-state-when-unsubscribing

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.

@sonarqubecloud
Copy link
Copy Markdown

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)
apps/portal/src/components/pages/unsubscribe-page.js (1)

269-269: Consider aligning with account-email-page.js using the shared helpers.

The fix is correct — member?.status === 'paid' excludes 'comped' members and resolves the bug. However, the sibling account-email-page.js uses isPaidMember({member}) && !isComplimentaryMember({member}), which relies on the helpers in utils/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 the status field is ever missing while paid/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

📥 Commits

Reviewing files that changed from the base of the PR and between c66e552 and e6c430b.

📒 Files selected for processing (2)
  • apps/portal/src/components/pages/account-email-page.js
  • apps/portal/src/components/pages/unsubscribe-page.js

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.

1 participant