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 API: backport changes from Core #52095

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Jun 29, 2023

What?

Backport changes to the Global styles revisions endpoint from Core to Gutenberg.

Changes include:

  • pagination
  • request headers X-Wp-Total and X-Wp-Totalpages
  • new tests

See: WordPress/wordpress-develop#4606

Testing Instructions

Check that there are no regressions. Check out the test description over at #50089

A quick way to test the endpoint in the site editor, fire up this branch and head over to the site editor.

In your browser's console, switch to the network tab and run the following :

await wp.apiFetch( { url: `/index.php?rest_route=%2Fwp%2Fv2%2Fglobal-styles%2F${ wp.data.select('core').__experimentalGetCurrentGlobalStylesId() }%2Frevisions&_locale=user` } );

Run PHP unit tests:

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

For the /global-styles/<id>/revisions endpoint, check that the response headers are set:

Screenshot 2023-06-29 at 12 45 04 pm

@ramonjd ramonjd added [Type] Task Issues or PRs that have been broken down into an individual action to take Core REST API Task Task for Core REST API efforts Backport from WordPress Core Pull request that needs to be backported to a Gutenberg release from WordPress Core labels Jun 29, 2023
@ramonjd ramonjd requested a review from spacedmonkey as a code owner June 29, 2023 03:08
@ramonjd ramonjd self-assigned this Jun 29, 2023
@ramonjd ramonjd force-pushed the update/global-revisions-rest-backport-core-changes branch 2 times, most recently from 6be3e43 to 7c56354 Compare June 29, 2023 03:28
@github-actions
Copy link

github-actions bot commented Jun 29, 2023

Flaky tests detected in 7c56354.
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/5408182604
📝 Reported issues:

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! The changes look good and revisions are still working as expected.

What about the class Gutenberg_REST_Global_Styles_Revisions_Controller added in #49974? Should that be moved to lib/compat/wordpress-6.3/ now that the controller is in core?

@ramonjd
Copy link
Member Author

ramonjd commented Jun 29, 2023

What about the class Gutenberg_REST_Global_Styles_Revisions_Controller added in #49974? Should that be moved to lib/compat/wordpress-6.3/ now that the controller is in core?

That was done a while back in b6986e0b, unless I'm missing something?

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

That was done a while back in b6986e0b, unless I'm missing something?

No, that's correct, I should have checked more carefully 😄

@ramonjd ramonjd merged commit b2b968d into trunk Jun 29, 2023
@ramonjd ramonjd deleted the update/global-revisions-rest-backport-core-changes branch June 29, 2023 22:27
@github-actions github-actions bot added this to the Gutenberg 16.2 milestone Jun 29, 2023
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 Core REST API Task Task for Core REST API efforts [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants