From 1ba86ab08cd3e7b97531f7f1d8d74af666c8b5a0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 5 May 2023 11:34:51 +0200 Subject: [PATCH] Release: 10.0.4 (#9357) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Empty commit for release pull request * Add 10.0.3 changelog * Update versions to 10.0.3 * Fix image editor in Featured Product/Category blocks on WP 6.2 (#9142) * Add 10.0.3 testing steps * Empty commit for release pull request * Check that the customized fallback template is archive-product before unsetting the source property (#9330) * use 'enqueue_block_assets' is available (#9332) * Remove esc_url() on self generated link to edit the Mini Cart template since it gets escaped in JS (#9348) * Add changelog entries to readme.txt * Update version number in several files * Add testing notes for the release * Add #9332 to testing notes * Add testing on frontend for #9332 --------- Co-authored-by: github-actions Co-authored-by: Albert Juhé Lluveras Co-authored-by: Tom Cafferkey Co-authored-by: Luigi Teschio Co-authored-by: Alexandre Lara --- composer.json | 2 +- .../testing/releases/1004.md | 43 +++++++++++++++++++ .../testing/releases/README.md | 1 + package-lock.json | 4 +- package.json | 2 +- readme.txt | 11 ++++- src/Assets/AssetDataRegistry.php | 16 ++++++- src/BlockTemplatesController.php | 2 +- src/Package.php | 2 +- woocommerce-gutenberg-products-block.php | 2 +- 10 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 docs/internal-developers/testing/releases/1004.md diff --git a/composer.json b/composer.json index e1a78087981..b516d4ab3a3 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "WooCommerce blocks for the Gutenberg editor.", "homepage": "https://woocommerce.com/", "type": "wordpress-plugin", - "version": "10.0.3", + "version": "10.0.4", "keywords": [ "gutenberg", "woocommerce", diff --git a/docs/internal-developers/testing/releases/1004.md b/docs/internal-developers/testing/releases/1004.md new file mode 100644 index 00000000000..f5a4bd604e5 --- /dev/null +++ b/docs/internal-developers/testing/releases/1004.md @@ -0,0 +1,43 @@ +# Testing notes and ZIP for release 10.0.4 + +Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-blocks/files/11398343/woocommerce-gutenberg-products-block.zip) + +## WooCommerce Core + +### Check that the customized fallback template is archive-product before saving. [(9330)](https://github.com/woocommerce/woocommerce-blocks/pull/9330) + +1. Go to Appearance > Site Editor and make sure no templates have any customizations +2. Make changes to Product Category and save. +3. Check these are reflected on the frontend. +4. Repeat step 2 +5. Check these are reflected on the frontend, and also in the templates list check this has not created an additional template as previously demonstrated in the linked issue. +6. Now clear all customizations again +7. Customize the Product Catalog template and save +8. Check these are reflected on the frontend for the product archive page, and all taxonomy pages (Category/Tags etc) +9. In the Site Editor make some customizations to the Product Category page and save. +10. Make sure these are reflected on the frontend, and also in the templates list check this has not created an additional template as previously demonstrated in the linked issue. +11. Make sure that the Product Catalog changes are still as intended and are reflected on the product archive page, and all taxonomy pages _except_ Product Category (since we have now created its own customized version in Step 9) + +### Fix: Edit Mini Cart template part URL [(9348)](https://github.com/woocommerce/woocommerce-blocks/pull/9348) + +1. Go to Appearance > Site Editor > Template Parts > Header +2. Add the Mini Cart block to the header. In the settings panel see the link "Edit Mini Basket template part". +3. Clicking this link should take you to the correct URL. + +### Use 'enqueue_block_assets' action when is available [(9332)](https://github.com/woocommerce/woocommerce-blocks/pull/9332) + +*Pre-requisites* +- Make sure to have some other plugins installed and activated (for example: Stripe) + +*Testing on the Site Editor* +1. Be sure that you have the Gutenberg trunk installed. +2. Open the Site Editor, and open the Single Product Template. +3. See that the placeholder image is loaded. +4. Disable the Gutenberg plugin. +5. Open the Site Editor, and open the Single Product Template. +6. See that the placeholder image is loaded. + +*Testing on the frontend* +1. With the Stripe plugin activated, go to your store; +6. Add a product to the cart; +6. Check if you are able to finish an order without errors; diff --git a/docs/internal-developers/testing/releases/README.md b/docs/internal-developers/testing/releases/README.md index df6a12b3b00..dee6a06cbfe 100644 --- a/docs/internal-developers/testing/releases/README.md +++ b/docs/internal-developers/testing/releases/README.md @@ -140,6 +140,7 @@ Every release includes specific testing instructions for new features and bug fi - [10.0.1](./1001.md) - [10.0.2](./1002.md) - [10.0.3](./1003.md) + - [10.0.4](./1004.md) diff --git a/package-lock.json b/package-lock.json index f9f2d6c888b..5c3ab6f019c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@woocommerce/block-library", - "version": "10.0.3", + "version": "10.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@woocommerce/block-library", - "version": "10.0.3", + "version": "10.0.4", "hasInstallScript": true, "license": "GPL-3.0+", "dependencies": { diff --git a/package.json b/package.json index 8e960800ba9..0555072b040 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@woocommerce/block-library", "title": "WooCommerce Blocks", "author": "Automattic", - "version": "10.0.3", + "version": "10.0.4", "description": "WooCommerce blocks for the Gutenberg editor.", "homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/", "keywords": [ diff --git a/readme.txt b/readme.txt index d683891203f..bddd00124d7 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks Requires at least: 6.1 Tested up to: 6.2 Requires PHP: 7.3 -Stable tag: 10.0.3 +Stable tag: 10.0.4 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -80,7 +80,14 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/ == Changelog == -= 10.0.3 - 2023-04-21 = += 10.0.4 - 2023-05-04 = + +#### Bug Fixes + +- Fix "Edit Mini Cart template part" URL for the Mini Cart block. ([9348](https://github.com/woocommerce/woocommerce-blocks/pull/9348)) +- Fix duplicate taxonomy templates being created on every save. ([9330](https://github.com/woocommerce/woocommerce-blocks/pull/9330)) + += 10.0.3 - 2023-04-20 = #### Bug Fixes diff --git a/src/Assets/AssetDataRegistry.php b/src/Assets/AssetDataRegistry.php index a72a81c960d..46494c2e174 100644 --- a/src/Assets/AssetDataRegistry.php +++ b/src/Assets/AssetDataRegistry.php @@ -66,11 +66,25 @@ public function __construct( Api $asset_api ) { * Hook into WP asset registration for enqueueing asset data. */ protected function init() { - add_action( 'init', array( $this, 'register_data_script' ) ); + if ( $this->is_site_editor() ) { + add_action( 'enqueue_block_editor_assets', array( $this, 'register_data_script' ) ); + } else { + add_action( 'init', array( $this, 'register_data_script' ) ); + } add_action( 'wp_print_footer_scripts', array( $this, 'enqueue_asset_data' ), 2 ); add_action( 'admin_print_footer_scripts', array( $this, 'enqueue_asset_data' ), 2 ); } + /** + * Checks if the current URL is the Site Editor. + * + * @return boolean + */ + protected function is_site_editor() { + $url_path = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; + return str_contains( $url_path, 'site-editor.php' ); + } + /** * Exposes core data via the wcSettings global. This data is shared throughout the client. * diff --git a/src/BlockTemplatesController.php b/src/BlockTemplatesController.php index 2d4315de69d..0bd8fd8cd7b 100644 --- a/src/BlockTemplatesController.php +++ b/src/BlockTemplatesController.php @@ -116,7 +116,7 @@ public function get_block_template_fallback( $template, $id, $template_type ) { return null; } - if ( count( $posts ) > 0 ) { + if ( count( $posts ) > 0 && 'archive-product' === $posts[0]->post_name ) { $template = _build_block_template_result_from_post( $posts[0] ); if ( ! is_wp_error( $template ) ) { diff --git a/src/Package.php b/src/Package.php index 73a833e7ab7..57be1d94869 100644 --- a/src/Package.php +++ b/src/Package.php @@ -109,7 +109,7 @@ public static function container( $reset = false ) { NewPackage::class, function ( $container ) { // leave for automated version bumping. - $version = '10.0.3'; + $version = '10.0.4'; return new NewPackage( $version, dirname( __DIR__ ), diff --git a/woocommerce-gutenberg-products-block.php b/woocommerce-gutenberg-products-block.php index 46334805d41..f241de50d6b 100644 --- a/woocommerce-gutenberg-products-block.php +++ b/woocommerce-gutenberg-products-block.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Blocks * Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block * Description: WooCommerce blocks for the Gutenberg editor. - * Version: 10.0.3 + * Version: 10.0.4 * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: woo-gutenberg-products-block