Skip to content

Conversation

@dkoo
Copy link
Contributor

@dkoo dkoo commented Dec 5, 2025

All Submissions:

Changes proposed in this Pull Request:

Tweaks for the Content Gates UI:

  • When only one gate exists, show expanded by default and hide drag/drop/resorting controls
  • Add badge to denote gate status
  • Swap order of Content and Access Rules sections (content comes first, then access)
  • Add controls to publish and unpublish gates
  • Add controls to trash, restore, and permanently delete gates
  • Control the expanded/collapsed state of gate card components when adding new gates (when adding a new gate, expand the new one and collapse all others)
  • When adding new gates, increment priority value so the newest gate is always last in order
  • Allow "enter" keypress to submit the "add content gate" modal
  • Reorganize metering settings into a separate Metering component for parity with AccessRules and ContentRules components

How to test the changes in this Pull Request:

  1. Start with zero content gate posts: wp post delete $(wp post list --post_type=np_content_gate --post_status=all --format=ids) --force
  2. Visit Audience > Content Gates and click "Add content gate". Enter a gate name and press the "enter" key to submit the form.
  3. Confirm that a new blank gate is created with "draft" status, and that it displays as expanded without any drag/drop or resorting controls:
Screenshot 2025-12-05 at 12 03 18 PM
  1. Confirm that the bottom of the card has "Delete", "Save Draft", and "Publish" buttons (but that the "Publish" button is disabled for now because there are no Content Rules or Access Rules yet)
  2. Add some Content Rules and Access Rules and confirm that the "Publish" button becomes available. Tweak metering settings to confirm no regressions. For now, click "Save Draft" and confirm that your changes are saved and persist after a page refresh. (Note: at this time, the added rules aren't yet validated to ensure that they'll do anything on the front-end, so it's still possible to publish a gate that won't render due to missing rules configuration.)
Screenshot 2025-12-05 at 12 03 31 PM
  1. Click "Publish" and confirm that the gate shows a "Published" status now. Confirm that the status persists after a refresh. Confirm that the buttons shown now are "Unpublish" and "Update".
Screenshot 2025-12-05 at 12 04 03 PM
  1. Make some more changes and click "Update", and confirm that changes persist after a refresh. Click "Unpublish" and confirm that the gate goes back to "Draft" status, and that the draft status persists after a refresh.
  2. Make sure the single gate component is expanded. Add another gate and confirm that the new draft gets added at the end of the gate list, and that both gate components now have drag/drop/resorting controls. Confirm that the existing gate component is automatically collapsed and that the new one is automatically expanded. Confirm that the drag/drop/resorting controls still work as expected.
  3. Click "Delete" for one of the gate posts, and confirm that it gets updated to "Trash" status. Confirm that the status persists after a refresh.
Screenshot 2025-12-05 at 12 03 46 PM
  1. As a reader, view restricted posts and confirm that you only ever see the published gate, never the trashed one even if it has more priority.
  2. Back in the admin, test the "Restore" and "Permanently delete" buttons for the trashed gate and make sure they set the gate to "draft" status and permanently delete the gate post from the DB, respectively.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo changed the title Feat/update content gates UI feat(content-gating): update content gates UI Dec 5, 2025
@dkoo dkoo changed the title feat(content-gating): update content gates UI feat: update content gate UI Dec 5, 2025
@dkoo dkoo self-assigned this Dec 5, 2025
@dkoo dkoo marked this pull request as ready for review December 5, 2025 22:35
@dkoo dkoo requested a review from a team as a code owner December 5, 2025 22:35
@dkoo dkoo requested a review from a team December 5, 2025 22:36
@dkoo dkoo added [Status] Needs Review The issue or pull request needs to be reviewed [Status] Needs Design Review labels Dec 5, 2025
@dkoo
Copy link
Contributor Author

dkoo commented Dec 5, 2025

Tagging @thomasguillot for a design review since this implements some of the UI changes we talked about but never implemented during the meetup. Also, I thought about the idea of adding some filter controls to show and hide Trashed gates, but I think this PR is big enough for now. We can always implement more controls in another PR.

@dkoo dkoo changed the title feat: update content gate UI feat(content-gating): update content gates UI Dec 6, 2025
@thomasguillot
Copy link
Contributor

thomasguillot commented Dec 10, 2025

@dkoo I pushed some small changes: 9224c6e

Copy link
Member

@miguelpeixe miguelpeixe left a comment

Choose a reason for hiding this comment

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

Great changes! A few comments inline

@github-actions github-actions bot added the [Status] Needs Changes or Feedback The issue or pull request needs action from the original creator label Dec 11, 2025
Base automatically changed from refactor/separate-content-gate-cpts to trunk December 11, 2025 21:32
@dkoo dkoo requested a review from miguelpeixe December 11, 2025 23:44
Copy link
Member

@miguelpeixe miguelpeixe left a comment

Choose a reason for hiding this comment

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

Thank you for the revisions!

@github-actions github-actions bot added the [Status] Approved The pull request has been reviewed and is ready to merge label Dec 12, 2025
@github-actions github-actions bot removed [Status] Needs Review The issue or pull request needs to be reviewed [Status] Needs Changes or Feedback The issue or pull request needs action from the original creator labels Dec 12, 2025
@dkoo dkoo merged commit 4e22075 into trunk Dec 12, 2025
12 checks passed
@dkoo dkoo deleted the feat/update-content-gates-ui branch December 12, 2025 16:18
@github-actions
Copy link

Hey @dkoo, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

matticbot pushed a commit that referenced this pull request Jan 9, 2026
# [6.29.0-alpha.1](v6.28.0...v6.29.0-alpha.1) (2026-01-09)

### Bug Fixes

* add default reader meta ([#4360](#4360)) ([01564ad](01564ad))
* **ads:** placement control value reset ([#4375](#4375)) ([72d7b68](72d7b68))
* **autocomplete:** improve value parsing in AutocompleteTokenField and ListsControl components ([#4376](#4376)) ([84e388d](84e388d))
* clarify the media credit placeholder image's labelling ([#4352](#4352)) ([4420b65](4420b65))
* **content-gating:** stop running `restrict_post` after gate is rendered ([#4368](#4368)) ([8489a6c](8489a6c))
* fallback password reset URL ([#4382](#4382)) ([06d1503](06d1503))
* hide 'trashed' subscriptions from My Account ([#4351](#4351)) ([e759378](e759378))
* **my-account:** top position on desktop ([#4355](#4355)) ([1b3255a](1b3255a))
* prevent doubled URL in reader registration block magic link ([#4379](#4379)) ([ba4d855](ba4d855))
* remove newspack-ui CSS class from my account when not logged in ([#4384](#4384)) ([2bb8630](2bb8630))
* remove space if no time ([#4380](#4380)) ([05c57e9](05c57e9))
* select specific product for content gifting and countdown banners ([#4366](#4366)) ([809c230](809c230))
* **sso:** change Jetpack configuration notice from error to warning ([#4383](#4383)) ([e5e0643](e5e0643))
* **subscriptions:** remove actions from gifted subscription ([#4362](#4362)) ([8fbc243](8fbc243))
* **update-payment-notice:** don't render on checkout ([#4356](#4356)) ([dd80c06](dd80c06))

### Features

* Add Managed Nextdoor Auth ([#4359](#4359)) ([fee2480](fee2480))
* add media credits to RSS feeds ([#4357](#4357)) ([e638447](e638447))
* **content-gating:** add Content Gate settings page ([#4363](#4363)) ([822c363](822c363))
* **content-gating:** enable content rule exclusions ([#4346](#4346)) ([1e5718b](1e5718b))
* **content-gating:** update content gates UI ([#4345](#4345)) ([4e22075](4e22075))
* rename newsletter tracking ([#4358](#4358)) ([3da6434](3da6434))
* **web-preview:** add ESC key support and dynamic titles for segments and prompts ([#4294](#4294)) ([7238d2f](7238d2f))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 6.29.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jan 19, 2026
# [6.29.0](v6.28.2...v6.29.0) (2026-01-19)

### Bug Fixes

* add default reader meta ([#4360](#4360)) ([01564ad](01564ad))
* **ads:** placement control value reset ([#4375](#4375)) ([72d7b68](72d7b68))
* **autocomplete:** improve value parsing in AutocompleteTokenField and ListsControl components ([#4376](#4376)) ([84e388d](84e388d))
* clarify the media credit placeholder image's labelling ([#4352](#4352)) ([4420b65](4420b65))
* **content-gating:** stop running `restrict_post` after gate is rendered ([#4368](#4368)) ([8489a6c](8489a6c))
* fallback password reset URL ([#4382](#4382)) ([06d1503](06d1503))
* hide 'trashed' subscriptions from My Account ([#4351](#4351)) ([e759378](e759378))
* **my-account:** top position on desktop ([#4355](#4355)) ([1b3255a](1b3255a))
* prevent doubled URL in reader registration block magic link ([#4379](#4379)) ([ba4d855](ba4d855))
* remove newspack-ui CSS class from my account when not logged in ([#4384](#4384)) ([2bb8630](2bb8630))
* remove space if no time ([#4380](#4380)) ([05c57e9](05c57e9))
* select specific product for content gifting and countdown banners ([#4366](#4366)) ([809c230](809c230))
* **sso:** change Jetpack configuration notice from error to warning ([#4383](#4383)) ([e5e0643](e5e0643))
* **subscriptions:** remove actions from gifted subscription ([#4362](#4362)) ([8fbc243](8fbc243))
* **update-payment-notice:** don't render on checkout ([#4356](#4356)) ([dd80c06](dd80c06))

### Features

* Add Managed Nextdoor Auth ([#4359](#4359)) ([fee2480](fee2480))
* add media credits to RSS feeds ([#4357](#4357)) ([e638447](e638447))
* **content-gating:** add Content Gate settings page ([#4363](#4363)) ([822c363](822c363))
* **content-gating:** enable content rule exclusions ([#4346](#4346)) ([1e5718b](1e5718b))
* **content-gating:** update content gates UI ([#4345](#4345)) ([4e22075](4e22075))
* rename newsletter tracking ([#4358](#4358)) ([3da6434](3da6434))
* **web-preview:** add ESC key support and dynamic titles for segments and prompts ([#4294](#4294)) ([7238d2f](7238d2f))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 6.29.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge [Status] Needs Design Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants