mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-09-23 18:29:49 +00:00
Merge "Make sticky header edit the default"
This commit is contained in:
commit
7812db242e
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue