From 7ebcf3ccff998b7b222e46486f8667f6c5859a03 Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Wed, 14 Sep 2022 15:24:36 -0700 Subject: [PATCH] Limit upgrading of Echo icons to Visual enhancements feature flag Currently we appear to be applying our icon/button enhancements to notifications menu if the icon field is present. These fields are not provided yet, but soon will be, so limiting to the feature flag. Bug: T257143 Change-Id: I2cf49a24f2db632e3ca23f749064929678bc8e19 --- includes/Hooks.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/Hooks.php b/includes/Hooks.php index d49cdc6e..47d761a2 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -316,6 +316,8 @@ class Hooks implements private static function updateUserLinksOverflowItems( $sk, &$content_navigation ) { $overflow = 'vector-user-menu-overflow'; $content_navigation[$overflow] = []; + $featureManager = VectorServices::getFeatureManager(); + $visualEnhancements = $featureManager->isFeatureEnabled( Constants::FEATURE_VISUAL_ENHANCEMENTS ); // Logged in and logged out overflow items if ( isset( $content_navigation['user-interface-preferences']['uls'] ) ) { @@ -339,6 +341,16 @@ class Hooks implements if ( isset( $content_navigation['notifications'] ) ) { foreach ( $content_navigation['notifications'] as $key => $data ) { $content_navigation[$overflow][$key] = $data; + if ( $visualEnhancements ) { + $content_navigation[$overflow][$key]['link-class'] = [ + // Allows Echo to react to clicks + 'mw-echo-notification-badge-nojs' + ]; + } else { + unset( $content_navigation[$overflow][$key]['icon'] ); + unset( $content_navigation[$overflow][$key]['button'] ); + unset( $content_navigation[$overflow][$key]['text-hidden'] ); + } } } if ( isset( $content_navigation['user-menu']['watchlist'] ) ) {