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

Declare gallery v2 field as optional #2740

Merged
merged 3 commits into from
May 29, 2023

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented May 26, 2023

Related PR: wordpress-mobile/WordPress-Android#18519

Fixes wordpress-mobile/WordPress-Android#17712

Description

This PR declares the galleryWithImageBlocks field to be optional, since it is sometimes omitted from the API response. In that case, this falls back to using the WordPress core version to determine whether v2 gallery support is enabled.

mkevins added 3 commits May 26, 2023 16:48
This can be used as a fallback when the API response omits the
galleryWithImageBlocks property.
By doing this, Gson won't coerce the missing value to false when the
property is omitted in the response, instead leaving it `null`. This
allows us to fallback to a reasonable value based on the WP version.
Copy link
Contributor

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

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

LGTM 🎊 ! Thanks @mkevins for fixing this 🙇 .

I've tested these changes in combo with wordpress-mobile/WordPress-Android#18519 and confirmed the Gallery block version is picked properly on different scenarios 🎊 :

NOTE: The latest version of the Gutenberg plugin that supports WP 5.8 is version 13.6.0 (The minimum supported WP version was set to 5.9 in Gutenberg plugin version 13.7).

Copy link
Contributor

@derekblank derekblank left a comment

Choose a reason for hiding this comment

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

I was also able to successfully test these changes for the described scenarios. 👍 🚀

@mkevins mkevins merged commit e1e7ea6 into trunk May 29, 2023
@mkevins mkevins deleted the fix/declare-gallery-v2-field-as-optional branch May 29, 2023 04:46
@mkevins
Copy link
Contributor Author

mkevins commented May 29, 2023

Thank you both for testing and reviewing these changes 👍

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.

Galleries with captioned images no longer function properly
3 participants