From 2f20720927cc41ef094fded8d8a7024d422cb194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Wed, 20 Mar 2019 11:24:12 +0100 Subject: [PATCH] Activity Panel: Hide Reviews Panel when Reviews are Disabled (https://github.com/woocommerce/woocommerce-admin/pull/1852) --- .../client/header/activity-panel/index.js | 16 +++++++++------- plugins/woocommerce-admin/lib/client-assets.php | 1 + 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/woocommerce-admin/client/header/activity-panel/index.js b/plugins/woocommerce-admin/client/header/activity-panel/index.js index 37088c54b9f..25ccd4a0075 100644 --- a/plugins/woocommerce-admin/client/header/activity-panel/index.js +++ b/plugins/woocommerce-admin/client/header/activity-panel/index.js @@ -112,13 +112,15 @@ class ActivityPanel extends Component { icon: , unread: false, }, - { - name: 'reviews', - title: __( 'Reviews', 'woocommerce-admin' ), - icon: , - unread: false, - }, - ]; + 'yes' === wcSettings.reviewsEnabled + ? { + name: 'reviews', + title: __( 'Reviews', 'woocommerce-admin' ), + icon: , + unread: false, + } + : null, + ].filter( Boolean ); } getPanelContent( tab ) { diff --git a/plugins/woocommerce-admin/lib/client-assets.php b/plugins/woocommerce-admin/lib/client-assets.php index bf0437de13b..6a6f643a965 100644 --- a/plugins/woocommerce-admin/lib/client-assets.php +++ b/plugins/woocommerce-admin/lib/client-assets.php @@ -195,6 +195,7 @@ function wc_admin_print_script_settings() { ), 'currentUserData' => $current_user_data, 'alertCount' => WC_Admin_Notes::get_notes_count( 'error,update', 'unactioned' ), + 'reviewsEnabled' => get_option( 'woocommerce_enable_reviews' ), ); $settings = wc_admin_add_custom_settings( $settings );