Navigation: Reset submenu before making Flyout (https://github.com/woocommerce/woocommerce-admin/pull/6396)

* reset flyout before adding things

* instructions and changelog
This commit is contained in:
Paul Sealock 2021-02-23 13:09:59 +13:00 committed by GitHub
parent da1afbc669
commit 5c2402e6f3
4 changed files with 152 additions and 120 deletions

View File

@ -1,10 +1,17 @@
Testing instructions
====================
# Testing instructions
## Unreleased
## 2.1.0
### Navigation: Reset submenu before making Flyout #6396
- Download and activate the MailChimp plugin.
- Turn on Navigation at Settings > Advanced > Features
- Return to the WP dashboard
- Hover over WooCommerce and see the flyout menu appear
- MailChimp should not be included.
### Email notes now are turned off by default #6324
- Create a zip for testing with `npm run zip:test`.
@ -55,6 +62,7 @@ wp db query 'SELECT status FROM wp_wc_admin_notes WHERE name = "wc-admin-add-fir
6. Make sure the menu item order is correct after unfavoriting.
7. Create a user with permissions to see some but not all registered WooCommerce pages.
8. Check that a user without permission to access a menu item cannot see said menu item.
### Remove CES actions for adding and editing a product and editing an order #6355
1. Add a product. The customer effort score survey should not appear.
@ -100,6 +108,7 @@ wp db query 'SELECT status FROM wp_wc_admin_notes WHERE name = "wc-admin-add-fir
- Go to WooCommerce home page
- Click on Display and Help button back and forth, check that the popover and the panel close as expected.
- Check that the setup store tab continues to work.
### Move capability checks to client #6365
1. Create various non-admin users with custom capabilities. Make sure to not include the `view_woocommerce_reports` for at least one role. https://wordpress.org/plugins/leira-roles/
@ -133,6 +142,7 @@ localStorage.setItem( 'debug', 'wc-admin:tracks' );
- Click on `Save changes`.
- Observe in developer console, `wcadmin_ces_snackbar_view` is logged when CES prompt is displayed.
- In the event props, it should have a new `settings_area` key followed by the value of the settings tab you have selected.
### Add navigation intro modal #6367
1. Visit the homescreen and dismiss the original welcome modal if you haven't already.
@ -234,6 +244,7 @@ localStorage.setItem( 'debug', 'wc-admin:tracks' );
- The enable/disable button should be correctly reflected in the Woocommerce payment settings screen as well.
Once everything is configured and enabled do a client test
- Make sure you have added a product and store homescreen (Finish the **Personalize my store** task)
- Navigate to one of the products and add it to the cart
- Click **go to checkout**

View File

@ -117,6 +117,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Dev: Change `siteUrl` to `homeUrl` on navigation site title #6240
- Dev: Add navigation favorites data store #6275
- Add: Add navigation intro modal. #6367
- Fix: Reset Navigation submenu before making Flyout #6396
== 2.0.0 02/05/2021 ==

View File

@ -514,26 +514,13 @@ class Menu {
}
/**
* Migrate any remaining WooCommerce child items.
* Add an item or taxonomy.
*
* @param array $menu Menu items.
* @return array
* @param array $menu_item Menu item.
*/
public function migrate_core_child_items( $menu ) {
global $submenu;
if ( ! isset( $submenu['woocommerce'] ) && ! isset( $submenu['edit.php?post_type=product'] ) ) {
return $menu;
}
$submenu_items = array_merge(
isset( $submenu['woocommerce'] ) ? $submenu['woocommerce'] : array(),
isset( $submenu['edit.php?post_type=product'] ) ? $submenu['edit.php?post_type=product'] : array()
);
foreach ( $submenu_items as $key => $menu_item ) {
public function add_item_and_taxonomy( $menu_item ) {
if ( in_array( $menu_item[2], CoreMenu::get_excluded_items(), true ) ) {
continue;
return;
}
$menu_item[2] = htmlspecialchars_decode( $menu_item[2] );
@ -541,12 +528,12 @@ class Menu {
// Don't add already added items.
$callbacks = self::get_callbacks();
if ( array_key_exists( $menu_item[2], $callbacks ) ) {
continue;
return;
}
// Don't add these Product submenus because they are added elsewhere.
if ( in_array( $menu_item[2], array( 'product_importer', 'product_exporter', 'product_attributes' ), true ) ) {
continue;
return;
}
self::add_plugin_item(
@ -574,6 +561,39 @@ class Menu {
}
}
/**
* Migrate any remaining WooCommerce child items.
*
* @param array $menu Menu items.
* @return array
*/
public function migrate_core_child_items( $menu ) {
global $submenu;
if ( ! isset( $submenu['woocommerce'] ) && ! isset( $submenu['edit.php?post_type=product'] ) ) {
return $menu;
}
$main_items = isset( $submenu['woocommerce'] ) ? $submenu['woocommerce'] : array();
$product_items = isset( $submenu['edit.php?post_type=product'] ) ? $submenu['edit.php?post_type=product'] : array();
foreach ( $main_items as $key => $menu_item ) {
self::add_item_and_taxonomy( $menu_item );
// phpcs:disable
if ( ! isset( $menu_item[ self::CSS_CLASSES ] ) ) {
$submenu['woocommerce'][ $key ][] .= ' hide-if-js';
} else if ( strpos( $submenu['woocommerce'][ $key ][ self::CSS_CLASSES ], 'hide-if-js' ) !== false ) {
continue;
} else {
$submenu['woocommerce'][ $key ][ self::CSS_CLASSES ] .= ' hide-if-js';
}
// phpcs:enable
}
foreach ( $product_items as $key => $menu_item ) {
self::add_item_and_taxonomy( $menu_item );
}
return $menu;
}