Skip to content

Commit

Permalink
Merge pull request #15196 from wordpress-mobile/rnmobile/fix/remove-i…
Browse files Browse the repository at this point in the history
…mage-count-from-gallery-processor

[Gutenberg] Remove image count from gallery processor
  • Loading branch information
mkevins authored Aug 18, 2021
2 parents 5c4539e + 6d5bba5 commit 744050e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ public GalleryBlockProcessor(String localId, MediaFile mediaFile, String siteUrl
}

@Override boolean processBlockJsonAttributes(JsonObject jsonAttributes) {
// The presence of `imageCount` means we have the new format, so return early to defer to recursive processing
if (jsonAttributes.has("imageCount")) {
return false;
}

// The new format does not have an `ids` attributes, so returning false here will defer to recursive processing
JsonArray ids = jsonAttributes.getAsJsonArray("ids");
if (ids == null || ids.isJsonNull()) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ object TestContent {
</figure>
<!-- /wp:image -->
"""
const val oldRefactoredGalleryBlock = """<!-- wp:gallery {"linkTo":"none","imageCount":3} -->
const val oldRefactoredGalleryBlock = """<!-- wp:gallery {"linkTo":"none"} -->
<figure class="wp-block-gallery blocks-gallery-grid has-nested-images columns-3 is-cropped">
$oldRefactoredGalleryBlockInnerBlocks</figure>
<!-- /wp:gallery -->
Expand Down Expand Up @@ -312,7 +312,7 @@ $oldRefactoredGalleryBlockInnerBlocks</figure>
<!-- /wp:image -->
"""

const val newRefactoredGalleryBlock = """<!-- wp:gallery {"linkTo":"none","imageCount":3} -->
const val newRefactoredGalleryBlock = """<!-- wp:gallery {"linkTo":"none"} -->
<figure class="wp-block-gallery blocks-gallery-grid has-nested-images columns-3 is-cropped">
$newRefactoredGalleryBlockInnerBlocks</figure>
<!-- /wp:gallery -->
Expand Down

0 comments on commit 744050e

Please sign in to comment.