From: Gergő Tisza Date: Mon, 23 Jul 2018 17:55:08 +0000 (+0200) Subject: Add explanation about JS editing changes to permission error X-Git-Tag: 1.34.0-rc.0~4610^2 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=334ee2f00c56290a80b6d76272f28f4997b2be04;p=lhc%2Fweb%2Fwiklou.git Add explanation about JS editing changes to permission error 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 --- diff --git a/includes/Title.php b/includes/Title.php index d3e0622f16..cc7d722fba 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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; } } diff --git a/languages/i18n/en.json b/languages/i18n/en.json index a9bd1f58da..edc18bb0c2 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -4484,6 +4484,7 @@ "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 editinterface right. If you do not understand why you are getting this error, see [[mw:MediaWiki_1.32/interface-admin]].", "rawhtml-notallowed": "<html> tags cannot be used outside of normal pages.", "gotointerwiki": "Leaving {{SITENAME}}", "gotointerwiki-invalid": "The specified title is invalid.", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 2ba449a5e9..d918a0806f 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -4684,6 +4684,7 @@ "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 <html> 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.",