-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Rename sync_status top wp_sync_status and move to top level field of wp_block post type #4761
Rename sync_status top wp_sync_status and move to top level field of wp_block post type #4761
Conversation
…wp_block post type
@TimothyBJacobs is this the sort of thing you were thinking in this comment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @glendaviesnz for the PR, Left some quick feedback.
src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php
Outdated
Show resolved
Hide resolved
This will need to be merged alongside the next lot of editor updates to be pulled in as it is dependent on those. |
It would be good to have a test for the postmeta field being moved up to top level field in rest response - will try and get that added tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this one 👍
✅ wp_pattern_sync_status
registration matches Gutenberg PR
✅ Gutenberg-only filter hasn't been backported
✅ Move of sync status to top level property works
As per your last comment, an extra test would be great 🙇
src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php
Outdated
Show resolved
Hide resolved
@aaronrobertshaw I have added that unit test. The e2e failures seem unrelated but I do not have the option to restart them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the test @glendaviesnz
I just have one question regarding the register_post_meta
call in the test. FWIW the test still passes when I update it to match the current registration of the wp_pattern_sync_status
post meta.
The e2e failures seem unrelated but I do not have the option to restart them
Unfortunately, I do not have that ability either. Perhaps @tellthemachines or @ramonjd could help here?
'properties' => array( | ||
'sync_status' => array( | ||
'type' => 'string', | ||
), | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'properties' => array( | |
'sync_status' => array( | |
'type' => 'string', | |
), | |
), | |
'enum' => array( 'partial', 'unsynced' ), |
Should this be matching the actual post meta registration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just mocking the minimum required to make the test valid, we are not testing the post meta registration, just that the meta field is moved so the only thing that matters in terms of this test is that a field of type string called wp_pattern_sync_status
is set.
I don't have a strong opinion on this though, can just copy and paste the full registration if that is seen as better practice.
Just to confirm that this PR also covers the changes in:
I too am not a member of the exalted group 😄 |
Yes, except for this bit which is only needed in plugin, not core. |
I restarted the tests. They've been super flaky lately so failures are unlikely to be related to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name change looks good to me, deferring to others re the changes to the rest api controller.
Unless you hear otherwise, I reckon this is good to go for the next beta. If anything needs to change, that will allow people to pick it up.
@@ -40,6 +40,7 @@ public function check_read_permission( $post ) { | |||
* Filters a response based on the context defined in the schema. | |||
* | |||
* @since 5.0.0 | |||
* @since 6.3 Adds the `wp_pattern_sync_status` postmeta property to the top level of response. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @since 6.3 Adds the `wp_pattern_sync_status` postmeta property to the top level of response. | |
* @since 6.3.0 Adds the `wp_pattern_sync_status` postmeta property to the top level of response. |
Either Tim or @spacedmonkey will have a better idea than I as to whether this is the best approach for moving the value to the top level.
Am I correct in thinking this endpoint is read only?
As discussed here this moves the
sync_status
postmeta to a top level field ofwp_block
, and also renames it towp_pattern_sync_status
as discussed here.Trac ticket: https://core.trac.wordpress.org/ticket/58677
Testing Instructions
wp_pattern_status
field is setScreenshots or screencast
Before:
After:
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.