Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global styles revisions Controller: return single revision only when it matches the parent id #59049

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Feb 15, 2024

What?

Brings global styles revisions controller Gutenberg_REST_Global_Styles_Revisions_Controller_6_5 in line with the changes from:

This change is required as WP_REST_Global_Styles_Revisions_Controller doesn't inherit WP_REST_Revisions_Controller.

Core backport:

Trac ticket

Why? And how?

WordPress/wordpress-develop#5655 explains:

This PR adds a condition to get_item that checks the revision parent id against the supplied parent id.

If it doesn't match, the method returns a 404.

This is to ensure that get_item does not return a revision whose parent does not match the parent route fragment.

Testing Instructions

npm run test:unit:php:base -- --filter Gutenberg_REST_Global_Styles_Revisions_Controller_Test

@ramonjd ramonjd added REST API Interaction Related to REST API Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core labels Feb 15, 2024
@ramonjd ramonjd self-assigned this Feb 15, 2024
Copy link

github-actions bot commented Feb 15, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress.

If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged.

If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack.

Thank you! ❤️

View changed files
❔ lib/compat/wordpress-6.5/class-gutenberg-rest-global-styles-revisions-controller-6-5.php
❔ phpunit/class-gutenberg-rest-global-styles-revisions-controller-test.php

Copy link

github-actions bot commented Feb 15, 2024

Flaky tests detected in 5bc68dc.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7909900259
📝 Reported issues:

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

LGTM! ✨

@ramonjd ramonjd merged commit ac607f4 into trunk Feb 15, 2024
62 checks passed
@ramonjd ramonjd deleted the backport/revisions-controller-get_item-parent-check branch February 15, 2024 05:46
@github-actions github-actions bot added this to the Gutenberg 17.8 milestone Feb 15, 2024
@creativecoder creativecoder added the [Type] Enhancement A suggestion for improvement. label Feb 21, 2024
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core.
  • Labels found: [Type] Enhancement, REST API Interaction, Global Styles, Backport from WordPress Core.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@creativecoder
Copy link
Contributor

Note that as part of curating the Gutenberg 17.8 changelog, I added the label [Type] Enhancement to this PR to better categorize it.

Please let me know if there is a different label that would be a better fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants