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
This commit is contained in:
Jon Robson 2022-09-14 15:24:36 -07:00 committed by Jdlrobson
parent 2d7d60a14a
commit 7ebcf3ccff
1 changed files with 12 additions and 0 deletions

View File

@ -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'] ) ) {