Implement temporary rollback confirmation toggle
authorTim Eulitz <tim.eulitz@wikimedia.de>
Mon, 4 Mar 2019 15:40:45 +0000 (16:40 +0100)
committerWMDE-Fisch <christoph.jauera@wikimedia.de>
Thu, 21 Mar 2019 13:21:13 +0000 (14:21 +0100)
This change implements a temporary feature toggle for the rollback
confirmation change. The main purpose is to allow users of certain wikis
(de-wiki, pl-wiki, for example) to turn off this upcoming feature before
it is released to production.

Bug: T217039
Change-Id: I6ed59afde5b75756053da3ae46858304dda9317d

includes/DefaultSettings.php
includes/Linker.php
includes/actions/RollbackAction.php
includes/preferences/DefaultPreferencesFactory.php
languages/i18n/en.json
languages/i18n/qqq.json

index 91170c4..3afa593 100644 (file)
@@ -9049,6 +9049,16 @@ $wgPriorityHints = false;
  */
 $wgElementTiming = false;
 
+/**
+ * Temporary option to show rollback confirmation user settings
+ * without activating the feature itself
+ * @see T217039
+ * @since 1.33
+ * @deprecated 1.33
+ * @var bool
+ */
+$wgDisableRollbackConfirmationFeature = false;
+
 /**
  * For really cool vim folding this needs to be at the end:
  * vim: foldmarker=@{,@} foldmethod=marker
index a02d57d..7dc6541 100644 (file)
@@ -1768,7 +1768,15 @@ class Linker {
                        $inner = $context->msg( 'brackets' )->rawParams( $inner )->escaped();
                }
 
-               if ( $context->getUser()->getBoolOption( 'showrollbackconfirmation' ) ) {
+               /**
+                * FIXME
+                * Remove all references to DisableRollbackConfirmationFeature
+                * after release of rollback feature. See T199534
+                */
+               if ( !MediaWikiServices::getInstance()
+                               ->getMainConfig()->get( 'DisableRollbackConfirmationFeature' ) &&
+                        $context->getUser()->getBoolOption( 'showrollbackconfirmation' )
+               ) {
                        $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
                        $stats->increment( 'rollbackconfirmation.event.load' );
                        $context->getOutput()->addModules( 'mediawiki.page.rollback.confirmation' );
index e2fc265..0e86fda 100644 (file)
@@ -73,12 +73,20 @@ class RollbackAction extends FormAction {
        }
 
        /**
+        * @throws ConfigException
         * @throws ErrorPageError
         * @throws ReadOnlyError
         * @throws ThrottledError
         */
        public function show() {
-               if ( $this->getUser()->getOption( 'showrollbackconfirmation' ) == false ||
+               /**
+                * FIXME
+                * Remove temporary check of DisableRollbackConfirmationFeature
+                * after release of rollback feature. See T199534
+                */
+               $config = \MediaWiki\MediaWikiServices::getInstance()->getMainConfig();
+               if ( $config->get( 'DisableRollbackConfirmationFeature' ) == true ||
+                        $this->getUser()->getOption( 'showrollbackconfirmation' ) == false ||
                         $this->getRequest()->wasPosted() ) {
                        $this->handleRollbackRequest();
                } else {
index a42726f..b2f5342 100644 (file)
@@ -870,6 +870,17 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                                'section' => 'rendering/advancedrendering',
                                'label-message' => 'tog-showrollbackconfirmation',
                        ];
+
+                       /**
+                        * FIXME
+                        * Remove temporary help text and references to DisableRollbackConfirmationFeature
+                        * after release of rollback feature. See T199534
+                        */
+                       if ( MediaWikiServices::getInstance()
+                               ->getMainConfig()->get( 'DisableRollbackConfirmationFeature' ) ) {
+                               $defaultPreferences['showrollbackconfirmation']
+                               ['help-message'] = 'tog-showrollbackconfirmation-prerelease-warning';
+                       }
                }
        }
 
index db247b9..8586606 100644 (file)
@@ -47,6 +47,7 @@
        "tog-useeditwarning": "Warn me when I leave an edit page with unsaved changes",
        "tog-prefershttps": "Always use a secure connection while logged in",
        "tog-showrollbackconfirmation": "Show a confirmation prompt when clicking on a rollback link",
+       "tog-showrollbackconfirmation-prerelease-warning": "Please note: This feature is not available yet. If you set this preference now, your choice will be remembered [https://meta.wikimedia.org/wiki/WMDE_Technical_Wishes/Rollback#Status when the feature is released].",
        "underline-always": "Always",
        "underline-never": "Never",
        "underline-default": "Skin or browser default",
index 109bba8..5305c43 100644 (file)
        "tog-useeditwarning": "Used as label for the checkbox in [[Special:Preferences#mw-prefsection-editing|Special:Preferences]].",
        "tog-prefershttps": "Toggle option used in [[Special:Preferences]] that indicates if the user wants to use a secure connection when logged in",
        "tog-showrollbackconfirmation": "Toggle option used in [[Special:Preferences]] to enable/disable rollback confirmation prompt. Should be visible only to users with rollback rights.",
+       "tog-showrollbackconfirmation-prerelease-warning": "Notice for wikis where the option can be set before the feature is enabled.\n\nNote: This notice is temporary and will only appear before the rollback confirmation feature is released.",
        "underline-always": "Used in [[Special:Preferences#mw-prefsection-rendering|Preferences]].\n\nThis option means \"always underline links\", there are also options {{msg-mw|Underline-never}} and {{msg-mw|Underline-default}}.\n\n{{Gender}}\n{{Identical|Always}}",
        "underline-never": "Used in [[Special:Preferences#mw-prefsection-rendering|Preferences]].\n\nThis option means \"never underline links\", there are also options {{msg-mw|Underline-always}} and {{msg-mw|Underline-default}}.\n\n{{Gender}}\n{{Identical|Never}}",
        "underline-default": "Used in [[Special:Preferences#mw-prefsection-rendering|Preferences]].\n\nThis option means \"underline links as in your user skin or your browser\", there are also options {{msg-mw|Underline-never}} and {{msg-mw|Underline-always}}.\n\n{{Gender}}\n{{Identical|Browser default}}",