From fd97fdcfd4b9fd95377fed41021aa60ebdcf19bc Mon Sep 17 00:00:00 2001 From: Bryan Elliott Date: Fri, 20 Dec 2024 09:43:39 -0500 Subject: [PATCH] Add comment explaining Protect status exception, per feedback. --- .../my-jetpack/_inc/components/product-card/status.tsx | 5 +++++ projects/packages/my-jetpack/src/products/class-protect.php | 1 + 2 files changed, 6 insertions(+) diff --git a/projects/packages/my-jetpack/_inc/components/product-card/status.tsx b/projects/packages/my-jetpack/_inc/components/product-card/status.tsx index 08772d563a9af..6dab3474fdf90 100644 --- a/projects/packages/my-jetpack/_inc/components/product-card/status.tsx +++ b/projects/packages/my-jetpack/_inc/components/product-card/status.tsx @@ -77,6 +77,11 @@ const getStatusClassName: StatusStateFunction = ( slug, status, isOwned ) => { return isOwned ? styles.warning : styles.inactive; case PRODUCT_STATUSES.EXPIRED: case PRODUCT_STATUSES.NEEDS_ATTENTION__WARNING: + /** + * For the Protect card, even when it has a NEEDS_ATTENTION__{WARNING | ERROR} + * status (it means threats have been detected), we still want to show the card + * status as 'Active'. + */ if ( slug === 'protect' ) { return styles.active; } diff --git a/projects/packages/my-jetpack/src/products/class-protect.php b/projects/packages/my-jetpack/src/products/class-protect.php index b06fd6f6b967b..8604aa3bb7a16 100644 --- a/projects/packages/my-jetpack/src/products/class-protect.php +++ b/projects/packages/my-jetpack/src/products/class-protect.php @@ -295,6 +295,7 @@ public static function does_module_need_attention() { if ( is_wp_error( $protect_data ) ) { return $protect_threat_status; // false } + $critical_threat_count = false; if ( ! empty( $protect_data->threats ) ) { $critical_threat_count = array_reduce( $protect_data->threats,