From 93c833030bf30a4ddebf0bbdf7c60c3278b94ccf Mon Sep 17 00:00:00 2001 From: Jon Robson Date: Thu, 19 Jan 2023 12:39:55 -0800 Subject: [PATCH] Make sticky header edit the default In production this is always true, so remove feature flag. Retain A/B testing code in case it is still needed. Bug: T324799 Change-Id: Ia2057eb69d0a8d3e6e51acb5729a4399fb17a18b --- includes/Constants.php | 15 --------------- includes/ServiceWiring.php | 20 -------------------- includes/SkinVector22.php | 4 +--- resources/skins.vector.es6/main.js | 24 +++++++++++------------- skin.json | 7 ------- 5 files changed, 12 insertions(+), 58 deletions(-) diff --git a/includes/Constants.php b/includes/Constants.php index 75df807cf..100104488 100644 --- a/includes/Constants.php +++ b/includes/Constants.php @@ -108,31 +108,16 @@ final class Constants { */ public const CONFIG_STICKY_HEADER = 'VectorStickyHeader'; - /** - * @var string - */ - public const CONFIG_STICKY_HEADER_EDIT = 'VectorStickyHeaderEdit'; - /** * @var string */ public const REQUIREMENT_STICKY_HEADER = 'StickyHeader'; - /** - * @var string - */ - public const REQUIREMENT_STICKY_HEADER_EDIT = 'StickyHeaderEdit'; - /** * @var string */ public const FEATURE_STICKY_HEADER = 'StickyHeader'; - /** - * @var string - */ - public const FEATURE_STICKY_HEADER_EDIT = 'StickyHeaderEdit'; - /** * Defines whether an A/B test is running. * diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 05ca67d19..e5fc0b6c7 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -160,17 +160,6 @@ return [ ) ); - $featureManager->registerRequirement( - new OverridableConfigRequirement( - $services->getMainConfig(), - $context->getUser(), - $context->getRequest(), - null, - Constants::CONFIG_STICKY_HEADER_EDIT, - Constants::REQUIREMENT_STICKY_HEADER_EDIT - ) - ); - $featureManager->registerFeature( Constants::FEATURE_STICKY_HEADER, [ @@ -179,15 +168,6 @@ return [ ] ); - $featureManager->registerFeature( - Constants::FEATURE_STICKY_HEADER_EDIT, - [ - Constants::REQUIREMENT_FULLY_INITIALISED, - Constants::REQUIREMENT_STICKY_HEADER, - Constants::REQUIREMENT_STICKY_HEADER_EDIT, - ] - ); - // Feature: Page tools menu // ================================ $featureManager->registerRequirement( diff --git a/includes/SkinVector22.php b/includes/SkinVector22.php index d0a29f422..bf50381ee 100644 --- a/includes/SkinVector22.php +++ b/includes/SkinVector22.php @@ -452,9 +452,7 @@ class SkinVector22 extends SkinMustache { // Show sticky ULS if the ULS extension is enabled and the ULS in header is not hidden $this->isULSExtensionEnabled() && !$this->shouldHideLanguages() ? new VectorComponentLanguageButton( $ulsLabels[ 'label' ] ) : null, - $featureManager->isFeatureEnabled( - Constants::FEATURE_STICKY_HEADER_EDIT - ) + true ) : null ]; foreach ( $components as $key => $component ) { diff --git a/resources/skins.vector.es6/main.js b/resources/skins.vector.es6/main.js index 9c87d7ecc..f3ac530c9 100644 --- a/resources/skins.vector.es6/main.js +++ b/resources/skins.vector.es6/main.js @@ -10,7 +10,6 @@ const pinnableElement = require( './pinnableElement.js' ), deferUntilFrame = require( './deferUntilFrame.js' ), ABTestConfig = require( /** @type {string} */ ( './config.json' ) ).wgVectorWebABTestEnrollment || {}, - stickyHeaderEditIconConfig = require( /** @type {string} */ ( './config.json' ) ).wgVectorStickyHeaderEdit || true, STICKY_HEADER_VISIBLE_CLASS = 'vector-sticky-header-visible', TOC_ID = 'vector-toc', BODY_CONTENT_ID = 'bodyContent', @@ -58,9 +57,9 @@ const getHeadingIntersectionHandler = ( changeActiveSection ) => { * @return {InitStickyHeaderABTests} */ function initStickyHeaderABTests( abConfig, isStickyHeaderFeatureAllowed, getEnabledExperiment ) { - let show = isStickyHeaderFeatureAllowed, + let showStickyHeader = isStickyHeaderFeatureAllowed, stickyHeaderExperiment, - noEditIcons = stickyHeaderEditIconConfig; + disableEditIcons = true; // One of the sticky header AB tests is specified in the config const abTestName = abConfig.name, @@ -75,35 +74,34 @@ function initStickyHeaderABTests( abConfig, isStickyHeaderFeatureAllowed, getEna ) { // If eligible, initialize the AB test stickyHeaderExperiment = getEnabledExperiment( abConfig ); + disableEditIcons = true; // If running initial or edit AB test, show sticky header to treatment groups // only. Unsampled and control buckets do not see sticky header. if ( abTestName === stickyHeader.STICKY_HEADER_EXPERIMENT_NAME || abTestName === stickyHeader.STICKY_HEADER_EDIT_EXPERIMENT_NAME ) { - show = stickyHeaderExperiment.isInTreatmentBucket(); + showStickyHeader = stickyHeaderExperiment.isInTreatmentBucket(); } // If running edit-button AB test, the edit buttons in sticky header are shown // to second treatment group only. if ( abTestName === stickyHeader.STICKY_HEADER_EDIT_EXPERIMENT_NAME ) { if ( stickyHeaderExperiment.isInTreatmentBucket( '1' ) ) { - noEditIcons = true; + disableEditIcons = true; } if ( stickyHeaderExperiment.isInTreatmentBucket( '2' ) ) { - noEditIcons = false; + disableEditIcons = false; } } - } else if ( - // T310750 Account for when the current experiment is not sticky header or it's disabled. - isStickyHeaderFeatureAllowed && ( !abConfig.enabled || !isStickyHeaderExperiment ) - ) { - noEditIcons = false; + } + if ( !abConfig.enabled ) { + disableEditIcons = false; } return { - showStickyHeader: show, - disableEditIcons: noEditIcons + showStickyHeader, + disableEditIcons }; } diff --git a/skin.json b/skin.json index 42be94623..695f11b97 100644 --- a/skin.json +++ b/skin.json @@ -575,13 +575,6 @@ }, "description": "@var array Enables a persistent header that allows quick access to user links, editing tools, search and other links while scrolling down a page" }, - "VectorStickyHeaderEdit": { - "value": { - "logged_in": false, - "logged_out": false - }, - "description": "@var array Enables the edit icons if $wgVectorStickyHeader is true." - }, "VectorWebABTestEnrollment": { "value": { "name": "skin-vector-toc-experiment",