jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/326839 )

Change subject: Feature flag FontChanger
......................................................................


Feature flag FontChanger

The flag is named `MinervaEnableFontChanger` and set to
`true` in beta.

Also remove an old message key.

Bug: T148193
Change-Id: Ifd189f8a6266d8d874f162949c6373fa916b299f
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/skins/SkinMinerva.php
M includes/skins/SkinMinervaBeta.php
R resources/skins.minerva.fontchanger/init.js
M tests/phpunit/skins/SkinMinervaTest.php
7 files changed, 52 insertions(+), 16 deletions(-)

Approvals:
  Pmiazga: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Jdlrobson: Looks good to me, approved



diff --git a/extension.json b/extension.json
index edaa83f..77f43a2 100644
--- a/extension.json
+++ b/extension.json
@@ -1729,22 +1729,16 @@
                                "mobile-frontend-watchlist-please-wait"
                        ]
                },
-               "skins.minerva.beta.scripts": {
+               "skins.minerva.fontchanger": {
                        "targets": [
                                "mobile",
                                "desktop"
                        ],
                        "dependencies": [
-                               "skins.minerva.scripts",
-                               "mobile.settings",
-                               "mobile.foreignApi",
-                               "mobile.backtotop"
+                               "mobile.settings"
                        ],
                        "scripts": [
-                               
"resources/skins.minerva.beta.scripts/fontchanger.js"
-                       ],
-                       "messages": [
-                               "mobile-frontend-commons-category-view"
+                               "resources/skins.minerva.fontchanger/init.js"
                        ]
                },
                "skins.minerva.tablet.scripts": {
@@ -2018,6 +2012,10 @@
                        "base": false,
                        "beta": true
                },
+               "MinervaEnableFontChanger": {
+                 "base": false,
+                 "beta": true
+               },
                "MFStripResponsiveImages": true,
                "MFResponsiveImageWhitelist": [
                        "image/svg+xml"
diff --git a/i18n/en.json b/i18n/en.json
index 022ace8..662a19d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -63,7 +63,6 @@
        "mobile-frontend-cite-error": "A problem occurred while attempting to 
load citations due to a bad revision identifier.",
        "mobile-frontend-cite-none-available": "There are no citations 
available for this page.",
        "mobile-frontend-clear-search": "Clear",
-       "mobile-frontend-commons-category-view": "Images for $1",
        "mobile-frontend-contribution-summary": "All edits made by 
{{GENDER:$1|[[User:$1|$1]]}}",
        "mobile-frontend-cookies-required": "Cookies are required to switch 
view modes. Please enable them and try again.",
        "mobile-frontend-copyright": "Content is available under $1 unless 
otherwise noted.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c4b65ae..dfc8ccc 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -63,7 +63,6 @@
        "mobile-frontend-cite-error": "Error message shown to user when 
citations fail to load which should only happen if a bad revision identifier is 
given.",
        "mobile-frontend-cite-none-available": "Error message shown when no 
citations are available for a page.",
        "mobile-frontend-clear-search": "Tooltip for clear button that appears 
when you type into search box.\n{{Identical|Clear}}",
-       "mobile-frontend-commons-category-view": "Link label, opens images 
associated with the subject matter.\nParameters:\n$1 - Title of page.",
        "mobile-frontend-contribution-summary": "Summary text that appears at 
the top of the [[Special:Contributions]] page for a given 
username.\n\nParameters:\n* $1 - username",
        "mobile-frontend-cookies-required": "Error message shown when user 
attempts to switch site modes and cookies are not enabled.",
        "mobile-frontend-copyright": "A short sentence explaining that the 
content of the page is available under a particular license. Parameters:\n* $1 
- license name\n'''See also'''\n* {{msg-mw|Copyright}}",
diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php
index 0708a0a..62a5148 100644
--- a/includes/skins/SkinMinerva.php
+++ b/includes/skins/SkinMinerva.php
@@ -1283,6 +1283,10 @@
                        $modules[] = 'skins.minerva.categories';
                }
 
+               if ( $this->mobileContext->getConfigVariable( 
'MinervaEnableFontChanger' ) ) {
+                       $modules[] = 'skins.minerva.fontchanger';
+               }
+
                return $modules;
        }
 
diff --git a/includes/skins/SkinMinervaBeta.php 
b/includes/skins/SkinMinervaBeta.php
index af19414..4bf35cf 100644
--- a/includes/skins/SkinMinervaBeta.php
+++ b/includes/skins/SkinMinervaBeta.php
@@ -19,11 +19,6 @@
         */
        public function getDefaultModules() {
                $modules = parent::getDefaultModules();
-               $modules['beta'] = [
-                       'skins.minerva.beta.scripts',
-               ];
-
-               Hooks::run( 'SkinMinervaDefaultModules', [ $this, &$modules ] );
 
                // Disable CentralNotice modules in beta
                if ( array_key_exists( 'centralnotice', $modules ) ) {
diff --git a/resources/skins.minerva.beta.scripts/fontchanger.js 
b/resources/skins.minerva.fontchanger/init.js
similarity index 100%
rename from resources/skins.minerva.beta.scripts/fontchanger.js
rename to resources/skins.minerva.fontchanger/init.js
diff --git a/tests/phpunit/skins/SkinMinervaTest.php 
b/tests/phpunit/skins/SkinMinervaTest.php
index e00a315..4f9b3b4 100644
--- a/tests/phpunit/skins/SkinMinervaTest.php
+++ b/tests/phpunit/skins/SkinMinervaTest.php
@@ -7,6 +7,7 @@
 use OutputPage;
 use SkinMinerva;
 use TestingAccessWrapper;
+use Title;
 
 class TestSkinMinerva extends SkinMinerva {
 
@@ -123,4 +124,44 @@
                        ],
                ];
        }
+
+       /**
+        * Test whether the font changer module is correctly added to the list 
context modules
+        *
+        * @covers SkinMinerva::getContextSpecificModules
+        * @dataProvider provideFontChangerModule
+        * @param $wgMinervaEnableFontChanger
+        * @param $expected
+        */
+       public function testFontChangerModule( $wgMinervaEnableFontChanger, 
$expected ) {
+               $skin = TestingAccessWrapper::newFromObject(
+                       $this->getMockBuilder( SkinMinerva::class )
+                               ->disableOriginalConstructor()
+                               ->setMethods( [ 'getTitle' ] )
+                               ->getMock()
+               );
+               $skin->mobileContext = MobileContext::singleton();
+               $skin->isMobileMode = 
$skin->mobileContext->shouldDisplayMobileView();
+               $title = Title::newFromText( 'Test' );
+               $skin->expects( $this->any() )
+                       ->method( 'getTitle' )
+                       ->will( $this->returnValue( $title ) );
+
+               $this->setMwGlobals( 'wgMinervaEnableFontChanger', [
+                       'base' => $wgMinervaEnableFontChanger
+               ] );
+
+               if ( $expected ) {
+                       $this->assertContains( 'skins.minerva.fontchanger', 
$skin->getContextSpecificModules() );
+               } else {
+                       $this->assertNotContains( 'skins.minerva.fontchanger', 
$skin->getContextSpecificModules() );
+               }
+       }
+
+       public function provideFontChangerModule() {
+               return [
+                       [ true, true ],
+                       [ false, false ],
+               ];
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/326839
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd189f8a6266d8d874f162949c6373fa916b299f
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to