Skip to content

Added gift subscriptions discovery section in membership settings#27982

Merged
minimaluminium merged 1 commit into
mainfrom
gift-subscriptions/discovery-link
May 20, 2026
Merged

Added gift subscriptions discovery section in membership settings#27982
minimaluminium merged 1 commit into
mainfrom
gift-subscriptions/discovery-link

Conversation

@minimaluminium
Copy link
Copy Markdown
Member

ref https://linear.app/ghost/issue/BER-3676/add-gift-subscriptions-discovery-link-in-settings

Mirrors the tips & donations pattern with a shareable link and preview/copy controls. Gated on the giftSubscriptions flag and Stripe being connected.

Mirrors the tips & donations pattern with a shareable link and preview/copy controls. Gated on the giftSubscriptions flag and Stripe being connected.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Review Change Stack

Walkthrough

This PR introduces gift subscriptions support to the admin settings. A new GiftSubscriptions component displays a shareable URL derived from the site URL with Preview and Copy actions. The component is integrated into Membership settings with search keywords and a feature flag check that requires both the giftSubscriptions flag and Stripe to be enabled. A corresponding navigation item and search keywords are added to the Sidebar, also gated by the same feature flag and Stripe availability conditions.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a gift subscriptions discovery section in membership settings, matching the changeset's primary objective.
Description check ✅ Passed The description is directly related to the changeset, explaining the implementation pattern (mirrors tips & donations), key features (shareable link, preview/copy controls), and gating conditions (feature flag and Stripe requirement).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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 gift-subscriptions/discovery-link

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.

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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In
`@apps/admin-x-settings/src/components/settings/membership/gift-subscriptions.tsx`:
- Line 10: The current giftUrl construction uses siteData?.url directly and can
produce "undefined/..." if siteData or siteData.url is missing; update the logic
around giftUrl (the giftUrl constant) to defensively handle missing siteData by
either returning early from the component when siteData?.url is falsy or by
computing a safe baseUrl (e.g., const base = siteData?.url ?
siteData.url.replace(/\/$/, '') : window.location?.origin || '') and then
building giftUrl from that base; ensure you reference the giftUrl constant and
any early-return placement inside the component so copy/preview are disabled or
hidden when valid siteData is unavailable.
- Around line 12-16: The copyGiftUrl function should handle clipboard failures
and clear the timeout on unmount: make writeText usage async and wrap it in
try/catch (call navigator.clipboard.writeText(giftUrl) inside copyGiftUrl,
setCopied(true) only on success and log or surface an error on failure), store
the timeout id in a ref (e.g. copyTimeoutRef) instead of an ephemeral value,
call setTimeout to reset setCopied(false) and save its id, and add a useEffect
cleanup that clears the timeout via clearTimeout(copyTimeoutRef.current) when
the component unmounts so no dangling timers remain; update references to
copyGiftUrl, setCopied, and giftUrl accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7333160a-941c-4b11-bd09-3ba1835bc997

📥 Commits

Reviewing files that changed from the base of the PR and between 7b87322 and 9543882.

⛔ Files ignored due to path filters (1)
  • apps/admin-x-design-system/src/assets/icons/gift.svg is excluded by !**/*.svg
📒 Files selected for processing (3)
  • apps/admin-x-settings/src/components/settings/membership/gift-subscriptions.tsx
  • apps/admin-x-settings/src/components/settings/membership/membership-settings.tsx
  • apps/admin-x-settings/src/components/sidebar.tsx

@minimaluminium minimaluminium merged commit 7f14191 into main May 20, 2026
42 checks passed
@minimaluminium minimaluminium deleted the gift-subscriptions/discovery-link branch May 20, 2026 08:43
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