Disable the new navigation in the WC Admin. (#36456)

* Disable the new navigation.

* Add changelog

* Fix linter errors.

* Disable the new_navigation option.'

* Navigation: disable the opt-out modal.

* Disable navigation for sites that have it turned off. Revert obsolete changes.

* Navigation: Add warning before disabling the navigation
in the Feature Settings.

* Linter errors.

* Correct the logic.

* Edit the notice text.

* Fixing linting errors."

* Tests: fix the copy.
This commit is contained in:
AnnaMag 2023-01-24 14:05:19 +01:00 committed by GitHub
parent 4341a53144
commit b78318525b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Disable the new navigation as the feature is on hold.

View File

@ -606,6 +606,26 @@ class FeaturesController {
$disabled = true;
$desc_tip = __( 'WooCommerce Admin has been disabled', 'woocommerce' );
} elseif ( 'new_navigation' === $feature_id ) {
$disabled = ! $this->feature_is_enabled( $feature_id );
if ( $disabled ) {
$update_text = sprintf(
// translators: 1: line break tag.
__( '%1$s The development of this feature is currently on hold.', 'woocommerce' ),
'<br/>'
);
} else {
$update_text = sprintf(
// translators: 1: line break tag.
__(
'%1$s This navigation will soon become unavailable while we make necessary improvements.
If you turn it off now, you will not be able to turn it back on.',
'woocommerce'
),
'<br/>'
);
}
$needs_update = version_compare( get_bloginfo( 'version' ), '5.6', '<' );
if ( $needs_update && current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
$update_text = sprintf(
@ -615,8 +635,11 @@ class FeaturesController {
'<a href="' . self_admin_url( 'update-core.php' ) . '" target="_blank">',
'</a>'
);
$disabled = true;
}
if ( ! empty( $update_text ) ) {
$description .= $update_text;
$disabled = true;
}
}

View File

@ -1702,13 +1702,12 @@ test.describe('Settings API tests: CRUD', () => {
"type": "checkbox",
})
]));
expect(responseJSON).toEqual(
expect.arrayContaining([
expect.objectContaining({
"id": "woocommerce_navigation_enabled",
"label": "Navigation",
"description": "Adds the new WooCommerce navigation experience to the dashboard",
"description": expect.stringContaining("Adds the new WooCommerce navigation experience to the dashboard"),
"type": "checkbox",
"value": expect.any(String),
})