diff --git a/i18n/en.json b/i18n/en.json index dbe5cd2..8a1804d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -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." } diff --git a/i18n/qqq.json b/i18n/qqq.json index 6692ff2..26e5d4e 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -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." } diff --git a/includes/MinervaHooks.php b/includes/MinervaHooks.php index 5f53fc9..be18db6 100644 --- a/includes/MinervaHooks.php +++ b/includes/MinervaHooks.php @@ -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, diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index 90cb2ad..aa45c47 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -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; } diff --git a/resources/skins.minerva.scripts/pageIssues.js b/resources/skins.minerva.scripts/pageIssues.js index 08ff7d5..cded394 100644 --- a/resources/skins.minerva.scripts/pageIssues.js +++ b/resources/skins.minerva.scripts/pageIssues.js @@ -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 diff --git a/skin.json b/skin.json index d3fb7ea..cc1d8dc 100644 --- a/skin.json +++ b/skin.json @@ -39,6 +39,10 @@ "base": false, "beta": true }, + "MinervaPageIssuesNewTreatment": { + "base": false, + "beta": true + }, "MinervaShowShareButton": { "base": false, "beta": false