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

Patterns: Check that core hasn't already moved sync status meta before moving and unsetting #52494

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

glendaviesnz
Copy link
Contributor

@glendaviesnz glendaviesnz commented Jul 11, 2023

What?

Adds a check to the 6.3 compat REST controller to make sure that core 6.3+ hasn't already moved and unset the wp_pattern_sync_status meta before trying to move it

Why?

Without this in place if running plugin on 6.3+ wp_pattern_sync_status always ends up empty so unsynced blocks appear as synced.

How?

Check for existence of post $data['wp_pattern_sync_status'] and if so assume in 6.3+ and return early.

Testing Instructions

  1. On 6.2.2 with plugin installed try adding synced and unsynced patterns via post editor and site editor and check that they appear as the correct sync status in the inserter
  2. On 6.3 beta with plugin installed try adding synced and unsynced patterns via post editor and site editor and check that they appear as the correct sync status in the inserter

@glendaviesnz glendaviesnz added [Type] Bug An existing feature does not function as intended [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Jul 11, 2023
@glendaviesnz glendaviesnz self-assigned this Jul 11, 2023
Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

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

This fixes the compat issue against Core trunk (6.3 beta 3) in that I can create a new unsynced pattern in the editor. See #52352 (comment)

The only issue I'm facing is that I can't add any unsynced pattern created during this process in a post or page. This is also my experience when testing on WordPress 6.2.2 as well however.

@ramonjd
Copy link
Member

ramonjd commented Jul 11, 2023

The only issue I'm facing is that I can't add any unsynced pattern created during this process in a post or page. This is also my experience when testing on WordPress 6.2.2 as well however.

Withdraw that. @glendaviesnz has schooled me that unsynced patterns don't currently appear in quick inserter in post editor - they need to be inserted from the patterns tab on inserter.

Thanks @glendaviesnz !

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, too, thanks for fixing this up!

@glendaviesnz glendaviesnz added the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Jul 11, 2023
@glendaviesnz glendaviesnz added this to the Gutenberg 16.2 milestone Jul 11, 2023
@ramonjd
Copy link
Member

ramonjd commented Jul 11, 2023

cc @fullofcaffeine / @ockham if this can be squeezed into 16.2 as it fixes compat with upcoming WP 6.3

@ramonjd
Copy link
Member

ramonjd commented Jul 11, 2023

Required to test #52352

@ramonjd ramonjd enabled auto-merge (squash) July 11, 2023 05:24
@ramonjd ramonjd merged commit ec66d6c into trunk Jul 11, 2023
48 checks passed
@ramonjd ramonjd deleted the fix/sync_status_meta_bug branch July 11, 2023 05:53
ockham pushed a commit that referenced this pull request Jul 11, 2023
…e moving and unsetting (#52494)

* Check that core hasn't already moved sync status meta before moving and unsetting

* remove whitespace
@ockham
Copy link
Contributor

ockham commented Jul 11, 2023

cc @fullofcaffeine / @ockham if this can be squeezed into 16.2 as it fixes compat with upcoming WP 6.3

Sure! Done in 62d4264 🙂

@ockham ockham removed the Backport to Gutenberg RC Pull request that needs to be backported to a Gutenberg release candidate (RC) label Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants