Add explanation about JS editing changes to permission error
authorGergő Tisza <tgr.huwiki@gmail.com>
Mon, 23 Jul 2018 17:55:08 +0000 (19:55 +0200)
committerGergő Tisza <gtisza@wikimedia.org>
Thu, 26 Jul 2018 23:25:48 +0000 (23:25 +0000)
This does not handle the error message when viewing a non-existent
page (noarticletext-nopermission), but that seems complicated to
get right.

Change-Id: Ia4e798b9a646908bd84fec5a53db929040e61aa7

includes/Title.php
languages/i18n/en.json
languages/i18n/qqq.json

index d3e0622..cc7d722 100644 (file)
@@ -2377,14 +2377,25 @@ class Title implements LinkTarget {
         */
        private function checkSiteConfigPermissions( $action, $user, $errors, $rigor, $short ) {
                if ( $action != 'patrol' ) {
+                       $error = null;
                        // Sitewide CSS/JSON/JS changes, like all NS_MEDIAWIKI changes, also require the
                        // editinterface right. That's implemented as a restriction so no check needed here.
                        if ( $this->isSiteCssConfigPage() && !$user->isAllowed( 'editsitecss' ) ) {
-                               $errors[] = [ 'sitecssprotected', $action ];
+                               $error = [ 'sitecssprotected', $action ];
                        } elseif ( $this->isSiteJsonConfigPage() && !$user->isAllowed( 'editsitejson' ) ) {
-                               $errors[] = [ 'sitejsonprotected', $action ];
+                               $error = [ 'sitejsonprotected', $action ];
                        } elseif ( $this->isSiteJsConfigPage() && !$user->isAllowed( 'editsitejs' ) ) {
-                               $errors[] = [ 'sitejsprotected', $action ];
+                               $error = [ 'sitejsprotected', $action ];
+                       }
+
+                       if ( $error ) {
+                               if ( $user->isAllowed( 'editinterface' ) ) {
+                                       // Most users / site admins will probably find out about the new, more restrictive
+                                       // permissions by failing to edit something. Give them more info.
+                                       // TODO remove this a few release cycles after 1.32
+                                       $error = [ 'interfaceadmin-info', wfMessage( $error[0], $error[1] ) ];
+                               }
+                               $errors[] = $error;
                        }
                }
 
index a9bd1f5..edc18bb 100644 (file)
        "edit-error-long": "Errors:\n\n$1",
        "revid": "revision $1",
        "pageid": "page ID $1",
+       "interfaceadmin-info": "$1\n\nPermissions for editing of sitewide CSS/JS/JSON files were recently separated from the <code>editinterface</code> right. If you do not understand why you are getting this error, see [[mw:MediaWiki_1.32/interface-admin]].",
        "rawhtml-notallowed": "&lt;html&gt; tags cannot be used outside of normal pages.",
        "gotointerwiki": "Leaving {{SITENAME}}",
        "gotointerwiki-invalid": "The specified title is invalid.",
index 2ba449a..d918a08 100644 (file)
        "edit-error-long": "Error message. Parameters:\n* $1 - the error details\nSee also:\n* {{msg-mw|edit-error-short}}\n{{Identical|Error}}",
        "revid": "Used to format a revision ID number in text. Parameters:\n* $1 - Revision ID number.\n{{Identical|Revision}}",
        "pageid": "Used to format a page ID number in text. Parameters:\n* $1 - Page ID number.",
+       "interfaceadmin-info": "Used to wrap the normal permission error for actions which used to only require editinterface but now require more permissions. Parameters:\n* $1 - The normal permission error.",
        "rawhtml-notallowed": "Error message given when $wgRawHtml = true; is set and a user uses an &lt;html&gt; tag in a system message or somewhere other than a normal page.",
        "gotointerwiki": "{{doc-special|GoToInterwiki}}\n\nSpecial:GoToInterwiki is a warning page displayed before redirecting users to external interwiki links. Its triggered by people going to something like [[Special:Search/google:foo]].\n{{Identical|Leaving}}",
        "gotointerwiki-invalid": "Message shown on Special:GoToInterwiki if given an invalid title.",