Merge "Make sticky header edit the default"

This commit is contained in:
jenkins-bot 2023-01-30 19:02:31 +00:00 committed by Gerrit Code Review
commit 7812db242e
5 changed files with 12 additions and 58 deletions

View file

@ -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.
*

View file

@ -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(

View file

@ -474,9 +474,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 ) {

View file

@ -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
};
}

View file

@ -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",