Merge "page issues is feature flagged"

This commit is contained in:
jenkins-bot 2018-11-20 22:44:40 +00:00 committed by Gerrit Code Review
commit 58cfdbff89
6 changed files with 38 additions and 5 deletions

View File

@ -54,5 +54,7 @@
"skin-minerva-mobile-option-MinervaShowCategoriesButton": "Categories",
"skin-minerva-mobile-option-MinervaShowCategoriesButton-description": "View categories of pages",
"skin-minerva-mobile-option-MinervaEnableBackToTop": "Jump to top",
"skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Jump to top of the current page using a floating button"
"skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Jump to top of the current page using a floating button",
"skin-minerva-mobile-option-MinervaPageIssuesNewTreatment": "Improved page issues treatment",
"skin-minerva-mobile-option-MinervaPageIssuesNewTreatment-description": "Page issues (Template:ambox) will be inlined in the article."
}

View File

@ -63,5 +63,7 @@
"skin-minerva-mobile-option-MinervaShowCategoriesButton": "Label for categories mobile web beta feature.\n{{Identical|Category}}",
"skin-minerva-mobile-option-MinervaShowCategoriesButton-description": "Description label for categories mobile web beta feature.",
"skin-minerva-mobile-option-MinervaEnableBackToTop": "Label for jump to top mobile web beta feature",
"skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Description label for jump to top mobile web beta feature"
"skin-minerva-mobile-option-MinervaEnableBackToTop-description": "Description label for jump to top mobile web beta feature",
"skin-minerva-mobile-option-MinervaPageIssuesNewTreatment": "Title for page issues feature flag displayed in Special:MobileOptions",
"skin-minerva-mobile-option-MinervaPageIssuesNewTreatment-description": "Description shown on Special:MobileOptions for page issues beta feature."
}

View File

@ -60,6 +60,13 @@ class MinervaHooks {
$config->get( 'MinervaShowShareButton' )
)
);
$featureManager->registerFeature(
new MobileFrontend\Features\Feature(
'MinervaPageIssuesNewTreatment',
'skin-minerva',
$config->get( 'MinervaPageIssuesNewTreatment' )
)
);
} catch ( RuntimeException $e ) {
// features already registered...
// due to a bug it's possible for this to run twice
@ -180,6 +187,10 @@ class MinervaHooks {
$mobileContext ),
SkinMinerva::OPTION_BACK_TO_TOP
=> $featureManager->isFeatureAvailableInContext( 'MinervaEnableBackToTop', $mobileContext ),
SkinMinerva::OPTION_PAGE_ISSUES
=> $featureManager->isFeatureAvailableInContext(
'MinervaPageIssuesNewTreatment', $mobileContext
),
SkinMinerva::OPTION_SHARE_BUTTON
=> $featureManager->isFeatureAvailableInContext( 'MinervaShareButton', $mobileContext ),
SkinMinerva::OPTION_TOGGLING => true,

View File

@ -32,6 +32,7 @@ class SkinMinerva extends SkinTemplate {
const OPTION_MOBILE_OPTIONS = 'mobileOptionsLink';
const OPTION_CATEGORIES = 'categories';
const OPTION_BACK_TO_TOP = 'backToTop';
const OPTION_PAGE_ISSUES = 'pageIssues';
const OPTION_SHARE_BUTTON = 'shareButton';
const OPTION_TOGGLING = 'toggling';
const OPTIONS_MOBILE_BETA = 'beta';
@ -104,6 +105,7 @@ class SkinMinerva extends SkinTemplate {
self::OPTION_SHARE_BUTTON => false,
/** Whether sections can be collapsed (requires MobileFrontend and MobileFormatter) */
self::OPTION_TOGGLING => false,
self::OPTION_PAGE_ISSUES => false,
];
/**
@ -322,6 +324,13 @@ class SkinMinerva extends SkinTemplate {
if ( $this->isAuthenticatedUser() ) {
$className .= ' is-authenticated';
}
// The new treatment should only apply to the main namespace
if (
$title->getNamespace() === NS_MAIN &&
$this->getSkinOption( self::OPTION_PAGE_ISSUES )
) {
$className .= ' issues-group-B';
}
return $className;
}

View File

@ -7,11 +7,13 @@
NS_TALK = 1,
NS_CATEGORY = 14,
CURRENT_NS = config.get( 'wgNamespaceNumber' ),
features = mw.config.get( 'wgMinervaFeatures', {} ),
pageIssuesParser = M.require( 'skins.minerva.scripts/pageIssuesParser' ),
PageIssuesOverlay = M.require( 'skins.minerva.scripts/PageIssuesOverlay' ),
// When the query string flag is set force on new treatment.
// When wgMinervaPageIssuesNewTreatment is the default this line can be removed.
QUERY_STRING_FLAG = mw.util.getParamValue( 'minerva-issues' ),
// T206179 should update this value to enable it
newTreatmentEnabled = QUERY_STRING_FLAG === 'b';
newTreatmentEnabled = features.pageIssues || QUERY_STRING_FLAG;
/**
* Create a link element that opens the issues overlay.
@ -167,7 +169,10 @@
inline = newTreatmentEnabled && CURRENT_NS === 0;
// set A-B test class.
$( 'html' ).addClass( newTreatmentEnabled ? 'issues-group-B' : 'issues-group-A' );
// When wgMinervaPageIssuesNewTreatment is the default this can be removed.
if ( newTreatmentEnabled ) {
$( 'html' ).addClass( 'issues-group-B' );
}
if ( CURRENT_NS === NS_TALK || CURRENT_NS === NS_CATEGORY ) {
// e.g. Template:English variant category; Template:WikiProject

View File

@ -39,6 +39,10 @@
"base": false,
"beta": true
},
"MinervaPageIssuesNewTreatment": {
"base": false,
"beta": true
},
"MinervaShowShareButton": {
"base": false,
"beta": false