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

Revisions controller: fix author and date fields #50117

Merged
merged 2 commits into from
Apr 27, 2023

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Apr 27, 2023

What, why, how?!

Correcting a mistake I made in #49974: we need the author, date and other details from the revision item not the parent

Testing Instructions

Run the tests!

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

For bonus points, create another admin user and save some global styles changes.

Check that the revision items reflect the revision author's details. You can grab them in the console:

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

Screenshot 2023-04-27 at 3 13 02 pm

…ther details from the revision item not the parent

Adding tests
@ramonjd ramonjd added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Apr 27, 2023
@ramonjd ramonjd requested a review from andrewserong April 27, 2023 05:15
@ramonjd ramonjd self-assigned this Apr 27, 2023
@ramonjd ramonjd requested a review from spacedmonkey as a code owner April 27, 2023 05:15
@ramonjd ramonjd mentioned this pull request Apr 27, 2023
4 tasks
@github-actions
Copy link

Flaky tests detected in 931affd.
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/4816248200
📝 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.

Great catch, thanks for the quick fix! How did we miss this earlier 😅

Before After
image image

LGTM! ✨

@andrewserong
Copy link
Contributor

For bonus points, create another admin user and save some global styles changes.

I decided I'd go for the bonus points 😄

Multiple users is working nicely, too:

image

@ramonjd ramonjd enabled auto-merge (squash) April 27, 2023 05:57
@ramonjd
Copy link
Member Author

ramonjd commented Apr 27, 2023

How did we miss this earlier

Thank you for the use of the first person plural, but it's okay in this case to say "How did YOU, @ramonjd, miss this earlier!?" 🤦 haha

Thanks for testing 🙇

@ramonjd ramonjd merged commit 3fc8957 into trunk Apr 27, 2023
@ramonjd ramonjd deleted the fix/revisions-controller-return-revision-values branch April 27, 2023 06:07
@github-actions github-actions bot added this to the Gutenberg 15.8 milestone Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants