Merge "Add a user preference to opt in or out of a confirmation prompt for rollbacks."
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 14 Mar 2019 13:17:47 +0000 (13:17 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 14 Mar 2019 13:17:47 +0000 (13:17 +0000)
1  2 
includes/preferences/DefaultPreferencesFactory.php
languages/i18n/en.json
languages/i18n/qqq.json

@@@ -121,7 -121,7 +121,7 @@@ class DefaultPreferencesFactory impleme
                $this->skinPreferences( $user, $context, $preferences );
                $this->datetimePreferences( $user, $context, $preferences );
                $this->filesPreferences( $context, $preferences );
-               $this->renderingPreferences( $context, $preferences );
+               $this->renderingPreferences( $user, $context, $preferences );
                $this->editingPreferences( $user, $context, $preferences );
                $this->rcPreferences( $user, $context, $preferences );
                $this->watchlistPreferences( $user, $context, $preferences );
                        ];
                }
  
 -              // Language
                $languages = Language::fetchLanguageNames( null, 'mwfile' );
                $languageCode = $this->config->get( 'LanguageCode' );
                if ( !array_key_exists( $languageCode, $languages ) ) {
        }
  
        /**
+        * @param User $user
         * @param MessageLocalizer $l10n
         * @param array &$defaultPreferences
         */
-       protected function renderingPreferences( MessageLocalizer $l10n, &$defaultPreferences ) {
+       protected function renderingPreferences(
+               User $user,
+               MessageLocalizer $l10n,
+               &$defaultPreferences
+       ) {
                # # Diffs ####################################
                $defaultPreferences['diffonly'] = [
                        'type' => 'toggle',
                        'options' => $stubThresholdOptions,
                        // This is not a raw HTML message; label-raw is needed for the manual <a></a>
                        'label-raw' => $l10n->msg( 'stub-threshold' )->rawParams(
 -                              '<a href="#" class="stub">' .
 +                              '<a class="stub">' .
                                $l10n->msg( 'stub-threshold-sample-link' )->parse() .
                                '</a>' )->parse(),
                ];
                        'section' => 'rendering/advancedrendering',
                        'label-message' => 'tog-numberheadings',
                ];
+               if ( $user->isAllowed( 'rollback' ) ) {
+                       $defaultPreferences['showrollbackconfirmation'] = [
+                               'type' => 'toggle',
+                               'section' => 'rendering/advancedrendering',
+                               'label-message' => 'tog-showrollbackconfirmation',
+                       ];
+               }
        }
  
        /**
                        );
                }
  
 -              AuthManager::callLegacyAuthPlugin( 'updateExternalDB', [ $user ] );
                $user->saveSettings();
  
                return $result;
diff --combined languages/i18n/en.json
@@@ -46,6 -46,7 +46,7 @@@
        "tog-norollbackdiff": "Don't show diff after performing a rollback",
        "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",
        "underline-always": "Always",
        "underline-never": "Never",
        "underline-default": "Skin or browser default",
        "badretype": "The passwords you entered do not match.",
        "usernameinprogress": "An account creation for this user name is already in progress.\nPlease wait.",
        "userexists": "Username entered already in use.\nPlease choose a different name.",
 +      "createacct-normalization": "Your username will be adjusted to \"$2\" due to technical restrictions.",
        "loginerror": "Login error",
        "createacct-error": "Account creation error",
        "createaccounterror": "Could not create account: $1",
        "ipb-confirm": "Confirm block",
        "ipb-sitewide": "Sitewide",
        "ipb-partial": "Partial",
 +      "ipb-sitewide-help": "Every page on the wiki and all other contribution actions.",
 +      "ipb-partial-help": "Specific pages or namespaces.",
        "ipb-pages-label": "Pages",
        "ipb-namespaces-label": "Namespaces",
        "badipaddress": "Invalid IP address",
        "logentry-rights-autopromote": "$1 was automatically {{GENDER:$2|promoted}} from $4 to $5",
        "logentry-upload-upload": "$1 {{GENDER:$2|uploaded}} $3",
        "logentry-upload-overwrite": "$1 {{GENDER:$2|uploaded}} a new version of $3",
 -      "logentry-upload-revert": "$1 {{GENDER:$2|uploaded}} $3",
 +      "logentry-upload-revert": "$1 {{GENDER:$2|reverted}} $3 to an old version",
        "log-name-managetags": "Tag management log",
        "log-description-managetags": "This page lists management tasks related to [[Special:Tags|tags]]. The log contains only actions carried out manually by an administrator; tags may be created or deleted by the wiki software without an entry being recorded in this log.",
        "logentry-managetags-create": "$1 {{GENDER:$2|created}} the tag \"$4\"",
        "log-action-filter-suppress-reblock": "User suppression by reblock",
        "log-action-filter-upload-upload": "New upload",
        "log-action-filter-upload-overwrite": "Reupload",
 +      "log-action-filter-upload-revert": "Revert",
        "authmanager-authn-not-in-progress": "Authentication is not in progress or session data has been lost. Please start again from the beginning.",
        "authmanager-authn-no-primary": "The supplied credentials could not be authenticated.",
        "authmanager-authn-no-local-user": "The supplied credentials are not associated with any user on this wiki.",
        "authmanager-create-no-primary": "The supplied credentials could not be used for account creation.",
        "authmanager-link-no-primary": "The supplied credentials could not be used for account linking.",
        "authmanager-link-not-in-progress": "Account linking is not in progress or session data has been lost. Please start again from the beginning.",
 -      "authmanager-authplugin-setpass-failed-title": "Password change failed",
 -      "authmanager-authplugin-setpass-failed-message": "The authentication plugin denied the password change.",
 -      "authmanager-authplugin-create-fail": "The authentication plugin denied the account creation.",
 -      "authmanager-authplugin-setpass-denied": "The authentication plugin does not allow changing passwords.",
 -      "authmanager-authplugin-setpass-bad-domain": "Invalid domain.",
        "authmanager-autocreate-noperm": "Automatic account creation is not allowed.",
        "authmanager-autocreate-exception": "Automatic account creation temporarily disabled due to prior errors.",
        "authmanager-userdoesnotexist": "User account \"$1\" is not registered.",
        "passwordpolicies-group": "Group",
        "passwordpolicies-policies": "Policies",
        "passwordpolicies-policy-display": "<span class=\"passwordpolicies-policy\">$1 <code>($2)</code></span>",
 +      "passwordpolicies-policy-displaywithflags": "<span class=\"passwordpolicies-policy\">$1 <code>($2)</code></span> <span class=\"passwordpolicies-policy-flags\">($3)</span>",
        "passwordpolicies-policy-minimalpasswordlength": "Password must be at least $1 {{PLURAL:$1|character|characters}} long",
        "passwordpolicies-policy-minimumpasswordlengthtologin": "Password must be at least $1 {{PLURAL:$1|character|characters}} long to be able to login",
        "passwordpolicies-policy-passwordcannotmatchusername": "Password cannot be the same as username",
        "passwordpolicies-policy-maximalpasswordlength": "Password must be less than $1 {{PLURAL:$1|character|characters}} long",
        "passwordpolicies-policy-passwordcannotbepopular": "Password cannot be {{PLURAL:$1|the popular password|in the list of $1 popular passwords}}",
        "passwordpolicies-policy-passwordnotinlargeblacklist": "Password cannot be in the list of 100,000 most commonly used passwords.",
 +      "passwordpolicies-policyflag-forcechange": "must change on login",
 +      "passwordpolicies-policyflag-suggestchangeonlogin": "suggest change on login",
        "easydeflate-invaliddeflate": "Content provided is not properly deflated",
        "unprotected-js": "For security reasons JavaScript cannot be loaded from unprotected pages. Please only create javascript in the MediaWiki: namespace or as a User subpage"
  }
diff --combined languages/i18n/qqq.json
        "tog-norollbackdiff": "Option in [[Special:Preferences]], 'Misc' tab. Only shown for users with the rollback right. By default a diff is shown below the return screen of a rollback. Checking this preference toggle will suppress that. {{Gender}}\n{{Identical|Rollback}}",
        "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",
        "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}}",
        "site-rss-feed": "Used in the HTML header of a wiki's RSS feed.\nHTML markup cannot be used.\n\nParameters:\n* $1 - <nowiki>{{SITENAME}}</nowiki>\n{{Identical|S1 RSS/Atom feed}}",
        "site-atom-feed": "Used in the HTML header of a wiki's Atom feed.\nHTML markup cannot be used.\n\nParameters:\n* $1 - <nowiki>{{SITENAME}}</nowiki>\n{{Identical|S1 RSS/Atom feed}}",
        "page-rss-feed": "Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Page-atom-feed}}\n{{Identical|S1 RSS/Atom feed}}",
 -      "page-atom-feed": "Parameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Page-rss-feed}}\n{{Identical|S1 RSS/Atom feed}}",
 +      "page-atom-feed": "Used as the \"title\" attribute in the <link rel=\"alternate\" type=\"application/atom+xml\"> element of the HTML source of the page. Not rendered in the web page.\n\nParameters:\n* $1 - page title\nSee also:\n* {{msg-mw|Page-rss-feed}}\n{{Identical|S1 RSS/Atom feed}}",
        "feed-atom": "{{optional}}\nSee also:\n* {{msg-mw|Feed-atom}}\n* {{msg-mw|Accesskey-feed-atom}}\n* {{msg-mw|Tooltip-feed-atom}}",
        "feed-rss": "{{optional}}\nSee also:\n* {{msg-mw|Feed-rss}}\n* {{msg-mw|Accesskey-feed-rss}}\n* {{msg-mw|Tooltip-feed-rss}}",
        "sitenotice": "{{Notranslate}}\n\nMediaWiki:Sitenotice is displayed above the page title for all users if it is defined, unless it is superseded by another notice. 'Defined' means it exists and has content other than the single character '-'.\n\nManual: [[mw:Manual:Interface/Sitenotice]]",
        "badretype": "Used as error message when the new password and its retype do not match.",
        "usernameinprogress": "Used as error message in creating a user account.",
        "userexists": "Used as error message in creating a user account.",
 +      "createacct-normalization": "Used as warning message on account creation when user name is adjusted silently due to technical restrictions (e.g. first letter capitalized, underscores converted to spaces).\nParameters:\n* $1 - the old username\n* $2 - the new username",
        "loginerror": "Used as title of error message.\n{{Identical|Login error}}",
        "createacct-error": "Used as heading for the error message.",
        "createaccounterror": "Parameters:\n* $1 - an error message",
        "ipb-confirm": "Used as hidden field in the form on [[Special:Block]].",
        "ipb-sitewide": "A type of block the user can select from on [[Special:Block]].",
        "ipb-partial": "A type of block the user can select from on [[Special:Block]].",
 +      "ipb-sitewide-help": "Help text describing the effects of a sitewide block on [[Special:Block]]",
 +      "ipb-partial-help": "Help text describing the effects of a partial block on  [[Special:Block]]",
        "ipb-pages-label": "The label for an autocomplete text field to specify pages to block a user from editing on [[Special:Block]].",
        "ipb-namespaces-label": "The label for an autocomplete text field to specify namespaces to block a user from editing on [[Special:Block]].",
        "badipaddress": "An error message shown when one entered an invalid IP address in blocking page.",
        "ip_range_toolarge": "Used as error message in [[Special:Block]]. Parameters:\n* $1 - a number from 0 to 32 for IPv4 (from 0 to 128 for IPv6); a part of CIDR (Classless Inter-Domain Routing) notation.\nSee also:\n* {{msg-mw|Range block disabled}}\n* {{msg-mw|Ip range invalid}}\n* {{msg-mw|Ip range toolarge}}",
        "ip_range_exceeded": "Used as error message in HTMLUserTextField when an IP range exceeds its maximum amount. See {{msg-mw|ip_range_toolarge}} for parameter.\n/$1 is the width as a number of bits.",
        "ip_range_toolow": "Used as error message in HTMLUserTextField, if effectively no IP ranges are interpreted as valid (IPv4 CIDR range /32 or IPv6 /128).",
 -      "proxyblocker": "Used in [[Special:BlockMe]].\n\nSee also:\n* {{msg-mw|proxyblocker-disabled}}\n* {{msg-mw|proxyblockreason}}\n* {{msg-mw|proxyblocksuccess}}",
 -      "proxyblockreason": "Used as explanation of the reason in [[Special:BlockMe]].\n\nSee also:\n* {{msg-mw|proxyblocker-disabled}}\n* {{msg-mw|proxyblocker}}\n* {{msg-mw|proxyblocksuccess}}",
 +      "proxyblocker": "Username for blocking IP addresses listed in [[mw:Manual:$wgProxyList|$wgProxyList]].\n\nSee also:\n* {{msg-mw|proxyblockreason}}",
 +      "proxyblockreason": "Reason for blocking IP addresses listed in [[mw:Manual:$wgProxyList|$wgProxyList]].\n\nSee also:\n* {{msg-mw|proxyblocker}}",
        "sorbs": "{{optional}}",
        "sorbsreason": "See also:\n* {{msg-mw|Sorbsreason}}\n* {{msg-mw|Sorbs create account_reason}}",
        "sorbs_create_account_reason": "Used in [[Special:UserLogin]] when creating an account.\n\nSee also:\n* {{msg-mw|Sorbsreason}}\n* {{msg-mw|Sorbs create account_reason}}",
        "log-action-filter-suppress-reblock": "{{doc-log-action-filter-action|suppress|reblock}}",
        "log-action-filter-upload-upload": "{{doc-log-action-filter-action|upload|upload}}",
        "log-action-filter-upload-overwrite": "{{doc-log-action-filter-action|upload|overwrite}}",
 +      "log-action-filter-upload-revert": "{{doc-log-action-filter-action|upload|revert}}",
        "authmanager-authn-not-in-progress": "Error message when AuthManager session data is lost during authentication, or the user hits the \"continue\" endpoint without an active authentication attempt.",
        "authmanager-authn-no-primary": "Error message when no AuthenticationProvider handles the AuthenticationRequests for login. This might mean the user needs to fill out all the form fields.",
        "authmanager-authn-no-local-user": "Error message when authentication somehow succeeds without a username being known. This probably should never happen.",
        "authmanager-create-no-primary": "Error message when no AuthenticationProvider handles the AuthenticationRequests for account creation. This might mean the user needs to fill out all the form fields.",
        "authmanager-link-no-primary": "Error message when no AuthenticationProvider handles the AuthenticationRequests for account linking. This might mean the user needs to fill out all the form fields.",
        "authmanager-link-not-in-progress": "Error message when AuthManager session data is lost during account linking, or the user hits the \"continue\" endpoint without an active account link attempt.",
 -      "authmanager-authplugin-setpass-failed-title": "Title of error page from AuthManager if AuthPlugin returns false from its setPassword() method.",
 -      "authmanager-authplugin-setpass-failed-message": "Text of error page from AuthManager if AuthPlugin returns false from its setPassword() method.",
 -      "authmanager-authplugin-create-fail": "Error message from AuthManager if the AuthPlugin returns false from its addUser() method.",
 -      "authmanager-authplugin-setpass-denied": "Error message from AuthManager if the AuthPlugin returns false from its allowPasswordChange() method.",
 -      "authmanager-authplugin-setpass-bad-domain": "Error message from AuthManager if the AuthPlugin rejects the passed domain.",
        "authmanager-autocreate-noperm": "Error message when auto-creation fails due to lack of permission.",
        "authmanager-autocreate-exception": "Error message when auto-creation fails because we tried recently and an exception was thrown, so we're not going to try again yet.",
        "authmanager-userdoesnotexist": "Error message when a user account does not exist. Parameters:\n* $1 - User name.",
        "passwordpolicies-summary": "The description used on [[Special:PasswordPolicies]].\n\nRefers to {{msg-mw|Passwordpolicies-helppage}}.",
        "passwordpolicies-group": "The title of the column in the table, about user groups (like you are in the ''translator'' group).\n\n{{Identical|Group}}\n{{Related|Passwordpolicies}}",
        "passwordpolicies-policies": "The title of the column in the table, about password policies.\n{{Related|Passwordpolicies}}",
 -      "passwordpolicies-policy-display": "{{optional}}\nParameters:\n* $1 - the text from the \"passwordpolicies-policy-...\" messages, i.e. {{msg-mw|passwordpolicies-policy-minimalpasswordlength}}\n* $2 - the name of this password policy",
 +      "passwordpolicies-policy-display": "{{optional}}\nParameters:\n* $1 - the text from the \"passwordpolicies-policy-...\" messages, e.g. {{msg-mw|passwordpolicies-policy-minimalpasswordlength}}\n* $2 - the name of this password policy",
 +      "passwordpolicies-policy-displaywithflags": "{{optional}}\nParameters:\n* $1 - the text from the \"passwordpolicies-policy-...\" messages, i.e. {{msg-mw|passwordpolicies-policy-minimalpasswordlength}}\n* $2 - the name of this password policy\n* $3 - comma-separated list of the text from the \"passwordpolicies-policyflag-...\" messages, e.g. {{msg-mw|passwordpolicies-policyflag-forcechange}}",
        "passwordpolicies-policy-minimalpasswordlength": "Password policy that enforces a minimum number of characters a password must be. $1 - minimum number of characters that a password can be",
        "passwordpolicies-policy-minimumpasswordlengthtologin": "Password policy that enforces a minimum number of characters a password must be to be able to login to the wiki. $1 - minimum number of characters that a password can be to be able to login",
        "passwordpolicies-policy-passwordcannotmatchusername": "Password policy that enforces that the password of the account cannot be the same as the username",
        "passwordpolicies-policy-maximalpasswordlength": "Password policy that enforces a maximum number of characters a password must be. $1 - maximum number of characters that a password can be",
        "passwordpolicies-policy-passwordcannotbepopular": "Password policy that enforces that a password is not in a list of $1 number of \"popular\" passwords. $1 - number of popular passwords the password will be checked against",
        "passwordpolicies-policy-passwordnotinlargeblacklist": "Password policy that enforces that a password is not in a list of 100,000 number of \"popular\" passwords.",
 +      "passwordpolicies-policyflag-forcechange": "Password policy flag that enforces changing invalid passwords on login.",
 +      "passwordpolicies-policyflag-suggestchangeonlogin": "Password policy flag that suggests changing invalid passwords on login.",
        "easydeflate-invaliddeflate": "Error message if the content passed to easydeflate was not deflated (compressed) properly",
        "unprotected-js": "Error message shown when trying to load javascript via action=raw that is not protected"
  }