-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Patterns: rename sync_status postmeta to pattern_post_sync_status #52232
Conversation
Size Change: +28 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
Thanks for raising this discussion in Slack, Glen. I did a quick search of the plugin repo and while I think it would be good to name it something more precise as in this PR. If the team wishes to fall back to the previous value for sites with the plugin active, then there are filters available. As this is a breaking change of GB (but not a WordPress release), I'm leaving a formal approval off the PR for y'all to discuss. |
Flaky tests detected in 520ee0f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5449979162
|
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.
LGTM
- unsynced and synced patterns in trunk still work in editor and frontend in this PR and are updated as I expected
- custom pattern library reflects the current state of my patterns
- new custom patterns work as expected
I only left a couple of doc nitpicks and some questions to improve my own understanding of this feature.
Thank you!
P.S. are the "before" and "after" screenshots in the wrong order in the description?
Unsynced pattern created on trunk
Same unsynced pattern as above on this PR
List view
Pattern library
Synced editing in the editor
* @see https://github.com/WordPress/gutenberg/pull/52232 | ||
*/ | ||
function gutenberg_legacy_wp_block_post_meta( $value, $object_id, $meta_key, $single ) { | ||
if ( 'wp_pattern_sync_status' !== $meta_key ) { |
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.
Just to confirm, for posts already created with 'sync_status'
, they are assigned the new metadata key in gutenberg_wp_block_register_post_meta
.
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.
it is a bit weird how metakeys works - they are assigned whether they were explicitly set or not, so if sync_status was actually assigned previously then its value is mapped to 'wp_pattern_sync_status' in gutenberg_wp_block_register_post_meta
- does that make sense?
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.
Yep, thanks for the explainer!
Also to confirm that the intention is for these changes to:
|
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.
Just a minor note to account for $single
based on a visual review of the code.
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.
Thank you for wrangling this rename @glendaviesnz 👍
I did notice the same $single
issue Peter noted. My local tweak was almost identical and it works both on this branch and after moving this PR's changes to trunk
as well. Which I believe we'll need so the block and site editor changes continue for future Gutenberg releases.
With the single fix applied:
✅ Endpoint returns correct value/s
✅ Existing patterns are displayed in their correct area on Patterns page
✅ Existing patterns are located correctly in post editor inserters
✅ Existing patterns reflect their correct sync status when post is edited directly
✅ New patterns function as above
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 latest changes look good.
I've given this a quick smoke test and didn't spot any issues.
…tus (#52232) --------- Co-authored-by: Kai Hao <[email protected]>
* add hint to show template part move (#52395) * Page Content Focus: Ignore page content within a Query Loop block (#52351) * Block Editor: Pass context and className props to editor.BlockEdit filter * Page Content Focus: Ignore content blocks that are within a Query Loop * Patterns: stop endless snackbars appearing (#52012) * Patterns: Distinguish between theme patterns and template parts in category list (#52382) * Allow opt out of auto-creation of Navigation fallback (#52319) * Update welcome guide copy (#52282) * Patterns: Update pattern copy (#52340) * Post Title: The changes should be reflected when previewing a post (#52369) * Update fixed block toolbar (#52123) * update the icons for expanding and collapsing the fixed block toolbar * hide the tools selector item in document tools for fixed toolbar preference * reveal undo, redo and list view buttons * tweaks for show icon labels and hide zoom out for top toolbar option * improve the responsiveness of the fixed block toolbar * remove the overflow rule - bad experiment * update top toolbar test with the new label for buttons * update the toolbar tests to account for moving the collapse button * Drop PHP 5.6 CI jobs (#52345) * Remove PHP 5.6 PHPUnit CI job * Raise version in phpcs / WPCS * Patterns: Add handling of sync status to the wp-admin patterns list page (#52346) * Exit template focus when opening the W menu (#52235) * wrap buttons (#52249) * Update the behavior of the cached undo/redo stack (#51644) Co-authored-by: Ella van Durpe <[email protected]> * Adjust top position (#52248) * Patterns: add a hint about the rename of reusable blocks to menu and inserter (#51771) Co-authored-by: Saxon Fletcher <[email protected]> * Site Editor: update headings hierarchy in the 'Manage all' screens (#52271) * This commit: - updates heading levels on the template and template part pages - passes a `level` prop to Header from Page * update h2 size * Rolling back custom sizes * Rolling back unnecessary classNames There was a rogue space in trunk. Let's let it live * Check randomizer experiment is enabled before rendering button (#52306) * Hide parent selector when parent is 'disabled' or 'contentOnly' (#52264) * Fix incorrect aria-describedby attributes for theme patterns (#52263) * Patterns: rename sync_status and move to top level field on rest return instead of a meta field (#52146) * Fix default block dimensions visibility (#52256) * core/heading * core/details * core/list * core/table * core/video * core/verse * core/social-links * core/site-title * core/site-tagline * core/site-logo * core/post-time-to-read * core/gallery * core/code * core/categories * core/audio * core/archives * Patterns: Display all custom template part areas in sidebar nav (#52355) * Revert phpcs back to PHP 5.6 (#52384) Reverts phpcs PHP compatibility version back to 5.6. * Check if experiment enabled fr this time (#52315) * Navigation: Remove one preloaded endpoint (#52115) * default to showing status (#52226) * Command palette: rename (#52153) * Revise use of “command menu” to “command palette”. Dropping "global" where it was used as well. * Find “command center” and replace with “command palette” * Image block and behaviors: Fix some warnings (#52109) * Fix first warning * Fix second warning - dividing a NaN * Turn off DFM for style book and style editing (#52117) * Add confirmation step when deleting a Template (#52236) * [Command Palette]: Remove suggestion for deleting templates/parts (#52168) * Update stepper styling in Home template details panel (#51972) * Update stepper styling * Remove !important * [Edit Post]: Add toggle fullscreen mode and list view commands (#52184) * Style Book: Show tabs and make blocks clickable when entering edit mode from the Styles menu (#52222) * Style Book: Show tabs and make blocks clickable when entering edit mode from the Styles menu * Move lines * !important (#52025) * Navigation in Site View: Readd the edit button (#52111) * Fix UnitControl crashing on regex control characters. Units are now escaped using `escapeRegExp` before concatenating them into a regular expression. Fixes #52211. --------- Co-authored-by: Mitchell Austin <[email protected]> * Patterns: rename wp_block sync_status postmeta to wp_pattern_sync_status (#52232) --------- Co-authored-by: Kai Hao <[email protected]> * Site Editor Frame: Ignore Spotlight in view mode (#52262) * Guide: Place focus on the guide's container instead of its first tabbable (#52300) * Guide: Place focus on the guide's container instead of its first tabbable * Update CHANGELOG * Post editor: Require confirmation before removing Footnotes (#52277) * Post editor: Require confirmation before removing Footnotes Context: #52176 * BlockRemovalWarningModal: Limit width to 40rem * Explain that footnotes are preserved. Add warning to Site Editor * Fix react-dropdown-menu version to avoid breaking change from one of … (#52356) * Fix react-dropdown-menu version to avoid breaking change from one if its dependencies. * Changelog update * move changelog entry to the right place * Update package-lock --------- Co-authored-by: Saxon Fletcher <[email protected]> Co-authored-by: Robert Anderson <[email protected]> Co-authored-by: Glen Davies <[email protected]> Co-authored-by: James Koster <[email protected]> Co-authored-by: Dave Smith <[email protected]> Co-authored-by: George Mamadashvili <[email protected]> Co-authored-by: Andrei Draganescu <[email protected]> Co-authored-by: Tonya Mork <[email protected]> Co-authored-by: Riad Benguella <[email protected]> Co-authored-by: Ella van Durpe <[email protected]> Co-authored-by: Ramon <[email protected]> Co-authored-by: Kai Hao <[email protected]> Co-authored-by: Rich Tabor <[email protected]> Co-authored-by: Aaron Robertshaw <[email protected]> Co-authored-by: Ben Dwyer <[email protected]> Co-authored-by: Mitchell Austin <[email protected]> Co-authored-by: Carlos Bravo <[email protected]> Co-authored-by: Nik Tsekouras <[email protected]> Co-authored-by: Aki Hamano <[email protected]> Co-authored-by: Timothy Jacobs <[email protected]> Co-authored-by: Kai Hao <[email protected]> Co-authored-by: Miguel Fonseca <[email protected]>
What?
Renames the new Patterns sync status postmeta field to
wp_patterns_sync_status
Why?
sync_status
is very generic and could inadvertently be used by other plugins.How?
Renamed the field in all the places it is used.
Testing Instructions
wp_pattern_status
Screenshots or screencast
Before:
After: