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

Pattern Directory: Merge Core locale, caching updates #33052

Merged
merged 4 commits into from
Jul 13, 2021

Conversation

iandunn
Copy link
Member

@iandunn iandunn commented Jun 28, 2021

Description

Merges https://core.trac.wordpress.org/changeset/51206 and https://core.trac.wordpress.org/changeset/51208, so the bundled versions of Core files are up to date with Core 5.8-beta4

Fixes #32754

How has this been tested?

  • Unit tests pass
  • Manual testing works

Manual testing:

  1. downgrade to wp 5.7 branch so the changesets above don't exist in core
  2. point api.wordpress.org to a w.org sandbox via /etc/hosts/ (if applicable)
  3. clear the locale transients
  4. refresh the editor to trigger a request
  5. view the request on the sandbox and see that the payload contains the locale. alternatively, you could observe the request w/ something like Burp Suite, the pre_http_request filter, etc.
  6. refresh again and observed that no request is made, because the results from the previous one were cached
  7. change locales and refreshe again, and see a new request on the sandbox, and a new transient created locally.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@iandunn iandunn force-pushed the update/pattern-locales branch 2 times, most recently from d83c6b7 to 52120d8 Compare June 29, 2021 00:09
@iandunn
Copy link
Member Author

iandunn commented Jun 29, 2021

The workflow failures are just the e2e tests timing out, they even do that locally. Seems like that's normal lately 🤷🏻‍♂️

@iandunn iandunn closed this Jun 29, 2021
@iandunn iandunn reopened this Jun 29, 2021
@iandunn iandunn force-pushed the update/pattern-locales branch from 52120d8 to c3fe41f Compare June 29, 2021 16:53
@iandunn iandunn changed the title [WIP] Pattern Directory: Merge Core locale, caching updates Pattern Directory: Merge Core locale, caching updates Jun 29, 2021
@iandunn iandunn marked this pull request as ready for review June 29, 2021 17:27
@Mamaduka
Copy link
Member

Mamaduka commented Jul 1, 2021

Hi, @iandunn

I think should_load_remote_block_patterns is missing from this update.

There were some issues with e2e tests, but I think rebase should fix it.

@iandunn
Copy link
Member Author

iandunn commented Jul 6, 2021

Ah, I only intended to backport the commits I made for https://core.trac.wordpress.org/ticket/53435. It looks like previous backports have rewritten Core code in a different way, and I don't have all the context about the "query" patterns, categories, etc. That makes it more difficult to backport other changes, but I've added the filter in 869e58e8.

I've also rebased to fix the e2e tests.

Beyond that, I'd prefer to keep the scope of this PR limited to the commits I have experience with, and let others backport anything they worked on.

Related #31922, #32591, #33126

Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

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

Seems to be working as expected on a 5.7 site - tried in English and Japanese, got the correct localized patterns back. Just the one note about since.

lib/block-patterns.php Show resolved Hide resolved
iandunn and others added 4 commits July 12, 2021 19:40
This information is needed by the w.org API for translation and caching.

Merges https://core.trac.wordpress.org/changeset/51206
See https://core.trac.wordpress.org/ticket/53435

Co-authored-by: Dion Hulse <[email protected]>
Co-authored-by: Kelly Dwan <[email protected]>
Co-authored-by: tellyworth <[email protected]>
Now that the pattern API request includes the locale and version, the cache key needs to contain a hash of the query args.

Merges https://core.trac.wordpress.org/changeset/51208
See https://core.trac.wordpress.org/ticket/53435

Co-authored-by: Dominik Schilling <[email protected]>
Co-authored-by: Dion Hulse <[email protected]>
Co-authored-by: Timothy Jacobs <[email protected]>
The tests were failing in `wp-env` because the latest Core updates had not been backported, so they were disabled in WordPress#32228. Now that the updates are backported, the tests pass again.
…ter.

The filter was added to Core during the process of syncing it with Gutenberg, but wasn't backported to Gutenberg until now.

See https://core.trac.wordpress.org/ticket/53246

Co-authored-by: Kelly Dwan <[email protected]>
@ryelle ryelle merged commit 2e872ff into WordPress:trunk Jul 13, 2021
@github-actions github-actions bot added this to the Gutenberg 11.1 milestone Jul 13, 2021
@iandunn iandunn deleted the update/pattern-locales branch July 13, 2021 16:38
@getdave getdave added the [Feature] Pattern Directory The Pattern Directory, a place to find patterns label Jul 22, 2021
@getdave getdave added the [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced label Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Pattern Directory The Pattern Directory, a place to find patterns [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced
Projects
None yet
Development

Successfully merging this pull request may close these issues.

api.w.org needs locale for pattern translation
4 participants