Skip to content

Gift links: admin UI (editor + settings) - #28630

Closed
jonatansberg wants to merge 1 commit into
ber-3728-gift-links-reader-accessfrom
ber-3729-gift-links-admin-ui
Closed

jonatansberg wants to merge 1 commit into
ber-3728-gift-links-reader-accessfrom
ber-3729-gift-links-admin-ui

Conversation

@jonatansberg

Copy link
Copy Markdown
Member

Slice 4 of 4 carving up the gift-links spike (#28625). Stacked on #28629.

ref https://linear.app/ghost/issue/BER-3729

What this adds (all behind the off giftLinks flag)

  • Editor: post-settings-menu inline gift-link control (copy / usage counter / reset-with-confirm) and a posts-list context-menu "Copy gift link" action.
  • Settings: "Reset all gift links" action in the danger zone (site-wide kill switch), with search keywords.
  • Consumes the admin API from slice 2.

Review fixes folded in

  • Dedup: extracted the gift-link URL builder and the canCopyGiftLink eligibility predicate (previously copy-pasted and already drifting between the two editor components) into a shared ghost/admin/app/utils/gift-link.js. Both components use it; published-check is now post.isPublished consistently.
  • Clipboard: the clipboard write is now awaited and success state only flips on a real successful write — fixes the Safari/Firefox silent-false-success where the write rejects (lost user-activation after the awaited POST) but the UI still claimed "Link copied". Failures surface an error notification.
  • Context-menu error handling: copyGiftLinkTask is wrapped in try/catch (mirroring copyPostsTask) and surfaces showAPIError instead of leaving the menu stuck in the loading state on a failed ensure POST.

Dead code dropped

  • The removed React modal leftovers (apps/posts/src/utils/{gift-link,copy-to-clipboard,analytics}.ts + tests, the giftLinkSlot prop) are confirmed absent and not referenced.
  • gift-links.ts keeps only useResetAllGiftLinks (the sole consumer is the danger zone); the three unused hooks were deleted.

Checks

  • tsc --noEmit passes for admin-x-framework and admin-x-settings.
  • eslint + ember-template-lint pass for all touched Ember files.
  • The new dangerzone "Reset all gift links" Playwright acceptance test passes.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 290d01a8-1afb-404f-ac5c-63fe50e007dc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ber-3729-gift-links-admin-ui

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.

@nx-cloud

nx-cloud Bot commented Jun 16, 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 c90d7ec

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 9m 24s View ↗
nx build @tryghost/sodo-search ✅ Succeeded <1s View ↗
nx build @tryghost/admin-toolbar ✅ Succeeded <1s View ↗
nx build @tryghost/comments-ui ✅ Succeeded <1s View ↗
nx build @tryghost/signup-form ✅ Succeeded <1s View ↗
nx build @tryghost/announcement-bar ✅ Succeeded <1s View ↗
nx build @tryghost/activitypub ✅ Succeeded 1s View ↗
nx build @tryghost/portal ✅ Succeeded <1s View ↗
Additional runs (8) ✅ Succeeded ... View ↗

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


☁️ Nx Cloud last updated this comment at 2026-06-22 07:06:07 UTC

@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from 175b158 to b8929b0 Compare June 16, 2026 14:30
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from c98f96d to 37f92fd Compare June 16, 2026 14:30
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from b8929b0 to 8cd81c6 Compare June 16, 2026 14:39
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from 37f92fd to bfa3dfa Compare June 16, 2026 14:39
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from 8cd81c6 to 8689fcd Compare June 17, 2026 06:31
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from bfa3dfa to d807a0a Compare June 17, 2026 06:32
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from 8689fcd to 53fd483 Compare June 17, 2026 06:52
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from d807a0a to b48d1d3 Compare June 17, 2026 06:52
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from 53fd483 to 124210d Compare June 17, 2026 07:54
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from b48d1d3 to b01bf1b Compare June 17, 2026 07:54
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from 124210d to bd3c6c4 Compare June 17, 2026 09:29
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from b01bf1b to e22db1b Compare June 17, 2026 09:29
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from bd3c6c4 to b6a6081 Compare June 17, 2026 10:13
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from e22db1b to 81a8dea Compare June 17, 2026 10:13
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from b6a6081 to 82f5eb2 Compare June 17, 2026 11:22
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch 2 times, most recently from 4a72ff7 to 91918fa Compare June 17, 2026 13:25
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from 82f5eb2 to e6b653b Compare June 17, 2026 13:25
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from e6b653b to a9646c3 Compare June 17, 2026 14:17
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from 91918fa to 2d2ffd6 Compare June 17, 2026 14:17
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from a9646c3 to f36455f Compare June 18, 2026 16:06
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from 2d2ffd6 to ebb6032 Compare June 18, 2026 16:06
ref https://linear.app/ghost/issue/BER-3729

- editor: post-settings-menu inline gift-link control (copy / usage /
  reset-confirm) and a posts-list context-menu copy action
- settings: "revoke all gift links" in the danger zone
- shared app/utils/gift-link.js for the URL builder + eligibility (no more
  duplicated/drifting copies); clipboard reports real success/failure;
  context-menu surfaces API errors instead of freezing
- eligibility covers Owner/Admin/Editor/Super Editor/Author (Authors limited
  to their own posts server-side), matching the API permission grant
- consumes the #28693 admin API: copy/reissue via PUT/POST
  /{posts,pages}/:id/gift_link; danger zone via PUT /gift_links/revoke_all
  (renamed from reset_all, response {meta:{count}})
- slice 4 of 4 carving up spike #28625; stacked on the reader slice (BER-3728)
  on top of the gift-links redesign (#28693)
@jonatansberg
jonatansberg force-pushed the ber-3728-gift-links-reader-access branch from f36455f to 59e6a67 Compare June 22, 2026 06:52
@jonatansberg
jonatansberg force-pushed the ber-3729-gift-links-admin-ui branch from ebb6032 to c90d7ec Compare June 22, 2026 06:52
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