Skip to content

Fixed retention offer not rendering for 1 mo repeating offers#26748

Merged
sagzy merged 2 commits intomainfrom
fix/retention-offer-not-showing-for-repeating
Mar 10, 2026
Merged

Fixed retention offer not rendering for 1 mo repeating offers#26748
sagzy merged 2 commits intomainfrom
fix/retention-offer-not-showing-for-repeating

Conversation

@sagzy
Copy link
Copy Markdown
Contributor

@sagzy sagzy commented Mar 10, 2026

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

  • when a member signs ups with a repeating 1 month offer, the next payment is not discounted
  • therefore, they should be able to redeem a retention offer

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

- when a member signs ups with a repeating 1 month offer, the next payment is not discounted
- therefore, they should be able to redeem a retention offer
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review


P2 Badge Preserve Stripe discount handling when offer_id is absent

The new if (!offerId) return false path drops the previous check for synced Stripe discounts, so subscriptions with discount_start/discount_end but no mapped offer_id are now treated as having no active offer. This can happen in existing sync paths that keep Stripe discount dates even when offer mapping fails (for example, invalid coupon-to-offer conversion), and it will surface retention offers while the next invoice is still discounted, allowing unintended stacking of discounts.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b1f6712a-b402-48a5-a826-3f7b34a87f98

📥 Commits

Reviewing files that changed from the base of the PR and between 7ba6ffe and b6c45dd.

📒 Files selected for processing (2)
  • ghost/core/core/server/services/members/members-api/repositories/member-repository.js
  • ghost/core/core/server/services/members/members-api/utils/has-active-offer.js

Walkthrough

has-active-offer was changed to accept an optional options parameter and now includes current_period_end in the subscription payload. Legacy discount_start/discount_end branch was removed; offer lookup is performed (offersAPI.getOffer) and discountWindow is derived via getDiscountWindow(subscriptionData, offer). Trial-based early exit remains; errors from offer lookup are caught and treated as blocking (returns true). Two end-to-end retention-offer tests and multiple unit tests were added and test helpers were extended to support startDate and currentPeriodEnd.

🚥 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 accurately describes the main change: fixing retention offers not displaying for 1-month repeating offers, which aligns with the changeset's focus on updating offer evaluation logic.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem (1-month repeating offers not discounting next payment) and the intended solution (enabling retention offer redemption).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/retention-offer-not-showing-for-repeating

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.

@ErisDS
Copy link
Copy Markdown
Member

ErisDS commented Mar 10, 2026

🤖 Velo CI Failure Analysis

Classification: 🟠 SOFT FAIL

  • Workflow: CI
  • Failed Step: E2E tests
  • Run: View failed run
    What failed: Code coverage below required threshold
    Why: The failure is caused by a code issue that needs to be fixed in this PR.
    Action:
    Check the error message and fix the issue in your code.

@sagzy sagzy merged commit 643769e into main Mar 10, 2026
30 checks passed
@sagzy sagzy deleted the fix/retention-offer-not-showing-for-repeating branch March 10, 2026 13:30
peterzimon pushed a commit that referenced this pull request Mar 10, 2026
closes https://linear.app/ghost/issue/BER-3413

- when a member signs ups with a repeating 1 month offer, the next
payment is not discounted
- therefore, they should be able to redeem a retention offer
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.

3 participants