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

Change subject: Hygiene: Remove experiment-related code
......................................................................


Hygiene: Remove experiment-related code

Changes:
* Remove $wgPopupsExperiment and $wgPopupsExperimentConfig config
  variables.
* Remove $wgPopupsExperimentIsBetaFeatureEnabled client-side config
  variable.
* Remove MakeGlobalVariablesScript hook handler as it's redundant.

Bug: T152687
Change-Id: Id25cd7c16da14b7ce9bad502565de9ff6d29434e
---
M Popups.hooks.php
M extension.json
M resources/ext.popups/boot.js
M resources/ext.popups/userSettings.js
M tests/qunit/ext.popups/stubs/user.js
M tests/qunit/ext.popups/userSettings.test.js
6 files changed, 3 insertions(+), 81 deletions(-)

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



diff --git a/Popups.hooks.php b/Popups.hooks.php
index 5972d14..0f29874 100644
--- a/Popups.hooks.php
+++ b/Popups.hooks.php
@@ -92,14 +92,8 @@
                }
 
                $config = self::getConfig();
-               $isExperimentEnabled = $config->get( 'PopupsExperiment' );
 
-               if (
-                       // If Popups are enabled as an experiment, then bypass 
checking whether the user has enabled
-                       // it as a beta feature.
-                       !$isExperimentEnabled &&
-                       $config->get( 'PopupsBetaFeature' ) === true
-               ) {
+               if ( $config->get( 'PopupsBetaFeature' ) === true ) {
                        if ( !class_exists( 'BetaFeatures' ) ) {
                                $logger = LoggerFactory::getInstance( 'popups' 
);
                                $logger->error( 'PopupsMode cannot be used as a 
beta feature unless ' .
@@ -160,29 +154,6 @@
        public static function onResourceLoaderGetConfigVars( array &$vars ) {
                $conf = self::getConfig();
                $vars['wgPopupsSchemaPopupsSamplingRate'] = $conf->get( 
'SchemaPopupsSamplingRate' );
-
-               if ( $conf->get( 'PopupsExperiment' ) ) {
-                       $vars['wgPopupsExperiment'] = true;
-                       $vars['wgPopupsExperimentConfig'] = $conf->get( 
'PopupsExperimentConfig' );
-               }
-       }
-
-       /**
-        * MakeGlobalVariablesScript hook handler.
-        *
-        * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/MakeGlobalVariablesScript
-        *
-        * @param array $vars
-        * @param OutputPage $out
-        */
-       public static function onMakeGlobalVariablesScript( array &$vars, 
OutputPage $out ) {
-               $config = self::getConfig();
-               $user = $out->getUser();
-
-               if ( $config->get( 'PopupsExperiment' ) ) {
-                       $vars['wgPopupsExperimentIsBetaFeatureEnabled'] =
-                               class_exists( 'BetaFeatures' ) && 
BetaFeatures::isFeatureEnabled( $user, 'popups' );
-               }
        }
 
        /**
diff --git a/extension.json b/extension.json
index 6fbf1cf..be4f8b6 100644
--- a/extension.json
+++ b/extension.json
@@ -28,9 +28,6 @@
                "ResourceLoaderGetConfigVars": [
                        "PopupsHooks::onResourceLoaderGetConfigVars"
                ],
-               "MakeGlobalVariablesScript": [
-                       "PopupsHooks::onMakeGlobalVariablesScript"
-               ],
                "GetPreferences": [
                        "PopupsHooks::onGetPreferences"
                ]
@@ -49,7 +46,6 @@
                "PopupsBetaFeature": false,
                "@SchemaPopupsSamplingRate": "@var number: Sample rate for 
logging events to Schema:Popups.",
                "SchemaPopupsSamplingRate": 0,
-               "PopupsExperiment": false,
                "@PopupsHideOptInOnPreferencesPage": "@var bool: Whether the 
option to enable/disable Page Previews should be hidden on Preferences page. 
Please note if PopupsBetaFeature is set to true this option will be always 
hidden. False by default",
                "PopupsHideOptInOnPreferencesPage": true,
                "@PopupsOptInDefaultState" : "@var string:[enabled|disabled] 
Default Page Previews visibility",
@@ -123,7 +119,6 @@
                                "popups-preview-footer-read"
                        ],
                        "dependencies": [
-                               "mediawiki.experiments",
                                "mediawiki.storage",
                                "mediawiki.Title",
                                "mediawiki.jqueryMsg",
diff --git a/resources/ext.popups/boot.js b/resources/ext.popups/boot.js
index c171953..9184371 100644
--- a/resources/ext.popups/boot.js
+++ b/resources/ext.popups/boot.js
@@ -90,7 +90,7 @@
                        isEnabled,
                        schema;
 
-               userSettings = mw.popups.createUserSettings( mw.storage, 
mw.user );
+               userSettings = mw.popups.createUserSettings( mw.storage );
                settingsDialog = mw.popups.createSettingsDialogRenderer();
                schema = mw.popups.createSchema( mw.config, window );
 
diff --git a/resources/ext.popups/userSettings.js 
b/resources/ext.popups/userSettings.js
index 47c4aea..88c60ca 100644
--- a/resources/ext.popups/userSettings.js
+++ b/resources/ext.popups/userSettings.js
@@ -12,11 +12,10 @@
         * encapsulate all interactions with the given User Agent's storage.
         *
         * @param {mw.storage} storage The `mw.storage` singleton instance
-        * @param {mw.user} user The `mw.user` singleton instance
         *
         * @return {ext.popups.UserSettings}
         */
-       mw.popups.createUserSettings = function ( storage, user ) {
+       mw.popups.createUserSettings = function ( storage ) {
                return {
 
                        /**
@@ -49,27 +48,6 @@
                         */
                        hasIsEnabled: function () {
                                return storage.get( IS_ENABLED_KEY, undefined ) 
!== undefined;
-                       },
-
-                       /**
-                        * Gets the user's Page Previews token.
-                        *
-                        * If the storage doesn't contain a token, then one is 
generated and
-                        * persisted to the storage before being returned.
-                        *
-                        * @return {String}
-                        */
-                       getToken: function () {
-                               var key = 'PopupsExperimentID',
-                                       id = storage.get( key );
-
-                               if ( !id ) {
-                                       id = user.generateRandomSessionId();
-
-                                       storage.set( key, id );
-                               }
-
-                               return id;
                        },
 
                        /**
diff --git a/tests/qunit/ext.popups/stubs/user.js 
b/tests/qunit/ext.popups/stubs/user.js
index a7da294..0377a9d 100644
--- a/tests/qunit/ext.popups/stubs/user.js
+++ b/tests/qunit/ext.popups/stubs/user.js
@@ -14,9 +14,6 @@
                        },
                        sessionId: function () {
                                return '0123456789';
-                       },
-                       generateRandomSessionId: function () {
-                               return '9876543210';
                        }
                };
        };
diff --git a/tests/qunit/ext.popups/userSettings.test.js 
b/tests/qunit/ext.popups/userSettings.test.js
index 0e2eb77..63c23f7 100644
--- a/tests/qunit/ext.popups/userSettings.test.js
+++ b/tests/qunit/ext.popups/userSettings.test.js
@@ -41,25 +41,6 @@
                );
        } );
 
-       QUnit.test( '#getToken', 2, function ( assert ) {
-               var token = this.userSettings.getToken();
-
-               assert.ok(
-                       token,
-                       '#getToken should return a token even if the storage is 
empty.'
-               );
-
-               assert.equal(
-                       this.storage.get( 'PopupsExperimentID' ),
-                       token,
-                       '#getToken persists the token in the storage 
transparently.'
-               );
-       } );
-
-       QUnit.test( '#getToken should always return the same token', 1, 
function ( assert ) {
-               assert.equal( this.userSettings.getToken(), 
this.userSettings.getToken() );
-       } );
-
        QUnit.test( '#getPreviewCount should return the count as a number', 
function ( assert ) {
                assert.expect( 3 );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id25cd7c16da14b7ce9bad502565de9ff6d29434e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: mpga
Gerrit-Owner: Phuedx <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhobs <[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