Skip to content

Fixed gift redemption recipient name - #30288

Merged
kevinansfield merged 1 commit into
mainfrom
fix/gift-redemption-recipient-name
Aug 26, 2026
Merged

Fixed gift redemption recipient name#30288
kevinansfield merged 1 commit into
mainfrom
fix/gift-redemption-recipient-name

Conversation

@kevinansfield

Copy link
Copy Markdown
Member

no issue

Gift redemption should keep a personalized gift addressed to its intended recipient, even when the buyer or another member opens the link while signed in.

  • Preferred the stored recipient name over the signed-in member name
  • Retained the member name as a fallback for gifts without a recipient name
  • Added regression coverage for signed-in viewers

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro

Run ID: 29237a13-f559-4d51-9f11-2d5b161237dc

📥 Commits

Reviewing files that changed from the base of the PR and between 52a82ae and 2a4c7e3.

📒 Files selected for processing (2)
  • apps/portal/src/components/pages/beta-gift-redemption-page.jsx
  • apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx

Included review availability: 2 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: Build E2E Public App Assets
  • GitHub Check: Unit tests (Node 22.23.1)
  • GitHub Check: Build Docker Images
  • GitHub Check: Check migration integrity
  • GitHub Check: Build Admin
  • GitHub Check: Stripe fixture checks
  • GitHub Check: i18n
  • GitHub Check: Check app version bump
  • GitHub Check: Lint
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (6)
These are independent public UMD/CDN surfaces, not embedded Shade apps. Review

⚙️ CodeRabbit configuration file

Files:

  • apps/portal/src/components/pages/beta-gift-redemption-page.jsx
  • apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx
Review whether tests prove changed behaviour, meaningful error/edge paths, and

⚙️ CodeRabbit configuration file

Files:

  • apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx
New source files must be TypeScript: flag new JS files as a required change

⚙️ CodeRabbit configuration file

Files:

  • apps/portal/src/components/pages/beta-gift-redemption-page.jsx
  • apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx
Prioritise concrete correctness, security, data-integrity, compatibility,

⚙️ CodeRabbit configuration file

Files:

  • apps/portal/src/components/pages/beta-gift-redemption-page.jsx
  • apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx
New files are TypeScript: Fail if the PR adds a new .js/.jsx/.cjs/.mjs source file, unless it is: a DB

📄 CodeRabbit inference engine (Custom checks)

Files:

  • apps/portal/src/components/pages/beta-gift-redemption-page.jsx
  • apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx
Always use `pnpm`, never npm or Yarn.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • apps/portal/src/components/pages/beta-gift-redemption-page.jsx
  • apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx
🔇 Additional comments (2)
apps/portal/src/components/pages/beta-gift-redemption-page.jsx (1)

62-62: LGTM!

Also applies to: 71-71

apps/portal/test/unit/components/pages/gift-redemption-page.test.jsx (1)

126-143: LGTM!


Walkthrough

The beta gift redemption page now initializes and resets the recipient name from gift.recipient_name before falling back to member.name. A unit test verifies that a logged-in member viewing a gift for another recipient sees the intended recipient’s name.

Suggested reviewers: 9larsons, weylandswart

Merge Risk: ⚪ Minimal · up to 2a4c7

The change keeps personalized gifts addressed to their stored recipient while retaining the signed-in member name as a fallback. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Type-Safe Boundaries ⚠️ Warning The changed precedence uses gift.recipient_name from an HTTP response for signed-in viewers without client-side validation. fetchRedemptionData returns res.json() directly, and `fetchGiftRedempt… Validate the gift redemption response at the HTTP API boundary before placing it in pageData. Use a Zod schema for the response and the consumed gift fields, including nullable recipient_name; derive any TypeScript types with z.infer
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains that gift redemption preserves the stored recipient name and adds regression coverage for signed-in viewers.
Title check ✅ Passed The title clearly identifies the main change: fixing the recipient name shown during gift redemption.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
New Files Are Typescript ✅ Passed The PR adds no new files. The PR commit changes only two pre-existing files: beta-gift-redemption-page.jsx and gift-redemption-page.test.jsx. The check excludes modifications to pre-existing JavaS…
Full details: Type-Safe Boundaries

Explanation

The changed precedence uses gift.recipient_name from an HTTP response for signed-in viewers without client-side validation. fetchRedemptionData returns res.json() directly, and fetchGiftRedemptionData stores response?.gifts?.[0] in pageData. The PR changes the short-circuit order in beta-gift-redemption-page.jsx, so this boundary value is now consumed when member.name exists. No Zod schema or other response validation exists in this path.

Resolution

Validate the gift redemption response at the HTTP API boundary before placing it in pageData. Use a Zod schema for the response and the consumed gift fields, including nullable recipient_name; derive any TypeScript types with z.infer rather than duplicating the schema. Only pass the parsed result to fetchGiftRedemptionData and the component.

Full details: New Files Are Typescript

Explanation

The PR adds no new files. The PR commit changes only two pre-existing files: beta-gift-redemption-page.jsx and gift-redemption-page.test.jsx. The check excludes modifications to pre-existing JavaScript files, so no failure condition applies.

✨ 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 fix/gift-redemption-recipient-name

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 25, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit a44d2f4

Command Status Duration Result
nx run-many -t test:unit -p @tryghost/portal ✅ Succeeded 1m 18s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 15s View ↗
nx run-many -t lint -p @tryghost/portal,ghost-m... ✅ Succeeded 7s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 2s View ↗
nx run @tryghost/admin:build ✅ Succeeded 4s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-26 08:17:59 UTC

@weylandswart weylandswart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested locally, working as expected.

no issue

Gift links can be opened by a signed-in buyer, but the card should remain addressed to the recipient chosen during purchase.

- Preferred the stored recipient name over the signed-in member name
- Covered signed-in viewers with a focused Portal regression test
@kevinansfield
kevinansfield force-pushed the fix/gift-redemption-recipient-name branch from 2a4c7e3 to a44d2f4 Compare August 26, 2026 08:14
@kevinansfield
kevinansfield enabled auto-merge (squash) August 26, 2026 08:16
@kevinansfield
kevinansfield merged commit 0186453 into main Aug 26, 2026
50 checks passed
@kevinansfield
kevinansfield deleted the fix/gift-redemption-recipient-name branch August 26, 2026 08:31
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