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

Update Global Styles endpoint to support non-experimental paths #16823

Merged
merged 7 commits into from
Jul 14, 2021

Conversation

chipsnyder
Copy link
Contributor

@chipsnyder chipsnyder commented Jul 7, 2021

This updates the Global styles endpoint to use the non-experimental paths for fetching the block editor settings.

Related PR wordpress-mobile/WordPressKit-iOS#416

To test:

For each of these cases, it'll be enough to open the editor and validate that the correct color options are available. It would also be useful to test using a network monitoring tool to make sure the correct paths are called. This will help ensure you aren't seeing cached data if you're reusing the same site for testing.

  • Self-Hosted Site with WP 5.8 and Gutenberg 11.1
    • Expect the request to be made with /wp-block-editor/v1
  • Self-Hosted Site with Gutenberg version <= 11.0
    • Expect the request to be made with /wp-block-editor/v1 which will fail, so the fallback of wp/v2/themes should be used
  • WPCom or Jetpack connected site with WP 5.8 and Gutenberg 11.0
    • Expect the request to be made with /wp-block-editor/v1
    • This will need to be tested with D63704 until that's deployed
  • WPCom or Jetpack connected site with WP 5.8 and Gutenberg version >= 11.1
    • Expect the request to be made with /wp-block-editor/v1=
    • This will need to be tested with D63704 until that's deployed

Regression Notes

  1. Potential unintended areas of impact
    N/A

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    N/A

  3. What automated tests I added (or what prevented me from doing so)
    Update unit tests to validate each flow

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jul 7, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Jul 7, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

DDLogError("Error fetching editor settings: \(err)")
// The user may not have the gutenberg plugin installed so try /wp/v2/themes to maintain feature support.
// In WP 5.9 we may be able to skip this attempt.
self.fetchTheme(completion)
Copy link

Choose a reason for hiding this comment

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

Retrying on error should be fine. I wonder if we can add an extra check for the specific error type (404).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nothing specific here but I wasn't sure of about all of the ways this could fail so I decided to play it safe.


// The app will call the none-experimental path first but fail because of compatibility reasons
mockOrgRemoteApi.completionPassedIn!(.failure(NSError(domain: "test", code: 404, userInfo: nil)), HTTPURLResponse())
// The app will then retry the experimental path.
Copy link

Choose a reason for hiding this comment

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

The test looks great. We just need to update the comment to reflect the removal of the experimental path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good callout I missed this one.

Copy link

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Great work @chipsnyder 👍
Tested this on an iPhone SE 2020 (iOS 14.4.1) and everything works as expected. The code LGTM 🎉
I just left two minor comments.

@chipsnyder chipsnyder merged commit ccd5c40 into develop Jul 14, 2021
@chipsnyder chipsnyder deleted the gutenberg/gss/endpoint_update branch July 14, 2021 21:22
@chipsnyder chipsnyder added this to the 17.9 milestone Jul 14, 2021
@chipsnyder chipsnyder mentioned this pull request Jul 20, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants