Repository navigation
Gift links: data foundation, model, permissions & labs flag - #28626
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (15)
WalkthroughA new Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
It looks like this PR contains a migration 👀 General requirements
Schema changes
Data changes
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin-x-settings:test:acceptance |
✅ Succeeded | 10m 11s | View ↗ |
nx run ghost:test:ci:integration:no-coverage |
✅ Succeeded | 1m 50s | View ↗ |
nx run ghost:test:ci:integration |
✅ Succeeded | 1m 5s | View ↗ |
nx run ghost:test:ci:e2e:no-coverage |
✅ Succeeded | 3m 51s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 3m 40s | View ↗ |
nx run ghost:test:ci:legacy |
✅ Succeeded | 2m 15s | View ↗ |
nx build @tryghost/announcement-bar |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/activitypub |
✅ Succeeded | 3s | View ↗ |
Additional runs (11) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-16 14:52:45 UTC
jonatansberg
left a comment
There was a problem hiding this comment.
There is a missing API snapshot that needs to be updated, otherwise the test will continue to fail.
9a064db to
9ed7a1d
Compare
ref https://linear.app/ghost/issue/BER-3726 - first slice of the gift-links feature, carved from spike #28625 - adds the gift_links table + model + per-post/reset-all permissions and the off-by-default `giftLinks` labs flag - per-post manage: Admin/Editor/Super Editor/Author (Authors limited to their own posts, enforced in the API slice); reset-all: Admin only - inert: no runtime behaviour until later slices wire up the service, API, reader route and admin UI
9ed7a1d to
4ba013d
Compare
|
The missing API snapshot is fixed — |
| // Per-post create/read/reset — Admin/Editor/Super Editor/Author (Owner inherits all | ||
| // permissions). Authors are limited to their own posts; that ownership check lives in | ||
| // the gift_links API endpoint, not in the role grant. | ||
| addPermissionWithRoles({ | ||
| name: 'Manage gift links', | ||
| action: 'manage', | ||
| object: 'gift_link' | ||
| }, [ | ||
| 'Administrator', | ||
| 'Editor', | ||
| 'Super Editor', | ||
| 'Author' | ||
| ]), | ||
| // Site-wide reset-all — Admin only (Owner inherits all permissions), tighter than per-post |
There was a problem hiding this comment.
Nit: Would these comments make sense to duplicate in the fixtures.json file as that's closer to the "source of truth" for our permissions?
| assertHavePermission(permissions, 'Delete posts', ['Administrator', 'Editor', 'Author', 'Contributor', 'Admin Integration', 'Super Editor']); | ||
| assertHavePermission(permissions, 'Publish posts', ['Administrator', 'Editor', 'Admin Integration', 'Scheduler Integration', 'Super Editor']); | ||
| assertHavePermission(permissions, 'Flush gift reminders', ['Scheduler Integration']); | ||
| assertHavePermission(permissions, 'Manage gift links', ['Administrator', 'Editor', 'Author', 'Super Editor']); |
There was a problem hiding this comment.
Non-blocker: Should Admin integrations have access to gift links so there is programmatic access/management?
There was a problem hiding this comment.
Added a ticket for us to track this
ref https://linear.app/ghost/issue/BER-3739/admin-integration-access-to-gift-links - fast-follow to the merged gift-links data foundation (#28626), addressing Kevin's review question about programmatic access/management - grants Admin Integration the same per-post `manage` permission Editors and Authors already have, so gift links can be created/reset over the Admin API; the endpoint's own edit.post ownership check still applies (integrations hold post:all, so they pass it) - the site-wide `resetAll` kill switch stays Administrator-only — a leaked integration key should not be able to nuke every active gift link at once - migration lands in the same 6.46 cycle as the foundation; fixtures + integrity hash + permission-count tests updated to match

Adds the data foundation for gift links: the
gift_linkstable,GiftLinkmodel, exporter wiring, and the manage/reset-all permissions (Administrator/Editor/Super Editor manage; Administrator-only reset-all). Also registers the off-by-defaultgiftLinkslabs flag plus its dev-experiments toggle.Inert: no runtime behaviour until later slices wire up the service, API, reader route and admin UI. This is slice 1 of 4 carving up spike PR #28625.
ref https://linear.app/ghost/issue/BER-3726