Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Release: 6.7.3 (#5617)
Browse files Browse the repository at this point in the history
* Enable Mini Cart template-parts only for experimental builds #5598 (#5606)

Enable Mini Cart template-parts only for experimental builds

* bump version to 6.7.3-dev

* Empty commit for release pull request

* update readme.txt

* add testing release notes

* Bumping version strings to new version.

Co-authored-by: Luigi Teschio <[email protected]>
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2022
1 parent 6596e0a commit 6e04cc6
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 9 deletions.
11 changes: 11 additions & 0 deletions docs/testing/releases/673.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Testing notes and ZIP for release 6.7.3

Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-gutenberg-products-block/files/7924587/woocommerce-gutenberg-products-block.zip)

## Feature plugin and package inclusion in WooCommerce

### Enable Mini Cart template-parts only for experimental builds ([5606](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5606))

1. Install Gutenberg (or use WordPress 5.9) and select a block theme e.g. `TT1 Blocks`.
2. Open Appearance > Editor > Templates Parts.
3. Check that `Mini Cart` template is NOT visible.
3 changes: 2 additions & 1 deletion docs/testing/releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ Every release includes specific testing instructions for new features and bug fi
- [6.6.0](./660.md)
- [6.7.0](./670.md)
- [6.7.1](./671.md)
- [6.7.2](./672.md)
- [6.7.2](./672.md)
- [6.7.3](./673.md)
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@woocommerce/block-library",
"title": "WooCommerce Blocks",
"author": "Automattic",
"version": "6.7.2",
"version": "6.7.3",
"description": "WooCommerce blocks for the Gutenberg editor.",
"homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/",
"keywords": [
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks
Requires at least: 5.8
Tested up to: 5.8
Requires PHP: 7.0
Stable tag: 6.7.2
Stable tag: 6.7.3
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -85,6 +85,12 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/

== Changelog ==

= 6.7.3 - 2022-01-24 =

#### Bug Fixes

- Enable Mini Cart template parts only for experimental builds. ([#5606](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5606))

= 6.7.2 - 2022-01-17 =

#### Bug Fixes
Expand Down
6 changes: 4 additions & 2 deletions src/BlockTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,14 @@ function ( $template ) use ( $template_slug ) {
* @param array $slugs An array of slugs to retrieve templates for.
* @param array $template_type wp_template or wp_template_part.
*
* @return array
* @return array WP_Block_Template[] An array of block template objects.
*/
public function get_block_templates( $slugs = array(), $template_type = 'wp_template' ) {
$templates_from_db = $this->get_block_templates_from_db( $slugs, $template_type );
$templates_from_woo = $this->get_block_templates_from_woocommerce( $slugs, $templates_from_db, $template_type );
return array_merge( $templates_from_db, $templates_from_woo );
$templates = array_merge( $templates_from_db, $templates_from_woo );
return BlockTemplateUtils::filter_block_templates_by_feature_flag( $templates );

}

/**
Expand Down
28 changes: 28 additions & 0 deletions src/Domain/Services/FeatureGating.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,32 @@ public function is_production_environment() {
public function is_test_environment() {
return self::TEST_ENVIRONMENT === $this->environment;
}

/**
* Returns core flag value.
*
* @return number
*/
public static function get_core_flag() {
return self::CORE_FLAG;
}

/**
* Returns feature plugin flag value.
*
* @return number
*/
public static function get_feature_plugin_flag() {
return self::FEATURE_PLUGIN_FLAG;
}

/**
* Returns experimental flag value.
*
* @return number
*/
public static function get_experimental_flag() {
return self::EXPERIMENTAL_FLAG;
}

}
2 changes: 1 addition & 1 deletion src/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static function container( $reset = false ) {
NewPackage::class,
function ( $container ) {
// leave for automated version bumping.
$version = '6.7.2';
$version = '6.7.3';
return new NewPackage(
$version,
dirname( __DIR__ ),
Expand Down
35 changes: 35 additions & 0 deletions src/Utils/BlockTemplateUtils.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php
namespace Automattic\WooCommerce\Blocks\Utils;

use Automattic\WooCommerce\Blocks\Domain\Services\FeatureGating;


/**
* BlockTemplateUtils class used for serving block templates from Woo Blocks.
* IMPORTANT: These methods have been duplicated from Gutenberg/lib/full-site-editing/block-templates.php as those functions are not for public usage.
Expand Down Expand Up @@ -414,4 +417,36 @@ public static function set_has_theme_file_if_fallback_is_available( $query_resul

return false;
}

/**
* Filter block templates by feature flag.
*
* @param WP_Block_Template[] $block_templates An array of block template objects.
*
* @return WP_Block_Template[] An array of block template objects.
*/
public static function filter_block_templates_by_feature_flag( $block_templates ) {
$feature_gating = new FeatureGating();
$flag = $feature_gating->get_flag();

/**
* An array of block templates with slug as key and flag as value.
*
* @var array
*/
$block_templates_with_feature_gate = array(
'mini-cart' => $feature_gating->get_experimental_flag(),
);

return array_filter(
$block_templates,
function( $block_template ) use ( $flag, $block_templates_with_feature_gate ) {
if ( isset( $block_templates_with_feature_gate[ $block_template->slug ] ) ) {
return $block_templates_with_feature_gate[ $block_template->slug ] <= $flag;
}
return true;
}
);
}

}
2 changes: 1 addition & 1 deletion woocommerce-gutenberg-products-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: 6.7.2
* Version: 6.7.3
* Author: Automattic
* Author URI: https://woocommerce.com
* Text Domain: woo-gutenberg-products-block
Expand Down

0 comments on commit 6e04cc6

Please sign in to comment.