Merge "Don't show the "permissions error" page after a user self-removes rights"

This commit is contained in:
jenkins-bot 2013-06-19 23:53:35 +00:00 committed by Gerrit Code Review
commit b24261d38f
4 changed files with 15 additions and 1 deletions

View file

@ -110,6 +110,17 @@ class UserrightsPage extends SpecialPage {
}
if ( !$this->userCanChangeRights( $user, true ) ) {
if ( $this->isself && $request->getCheck( 'success' ) ) {
// bug 48609: if the user just removed its own rights, this would
// leads it in a "permissions error" page. In that case, show a
// message that it can't anymore use this page instead of an error
$this->setHeaders();
$out = $this->getOutput();
$out->wrapWikiMsg( "<div class=\"successbox\">\n$1\n</div>", 'userrights-removed-self' );
$out->returnToMain();
return;
}
// @todo FIXME: There may be intermediate groups we can mention.
$msg = $user->isAnon() ? 'userrights-nologin' : 'userrights-notallowed';
throw new PermissionsError( null, array( array( $msg ) ) );
@ -163,7 +174,7 @@ class UserrightsPage extends SpecialPage {
}
function getSuccessURL() {
return $this->getTitle( $this->mTarget )->getFullURL();
return $this->getTitle( $this->mTarget )->getFullURL( array( 'success' => 1 ) );
}
/**

View file

@ -2012,6 +2012,7 @@ Your email address is not revealed when other users contact you.',
'userrights-unchangeable-col' => 'Groups you cannot change',
'userrights-irreversible-marker' => '$1*', # only translate this message to other languages if you have to change it
'userrights-conflict' => 'User rights conflict! Please apply your changes again.',
'userrights-removed-self' => 'You successfully removed your own rights. As such, you are no longer able to access this page.',
# Groups
'group' => 'Group:',

View file

@ -2727,6 +2727,7 @@ Parameters:
* $1 - optional, for PLURAL use, the number of items in the column following the message. Avoid PLURAL, if your language allows that.',
'userrights-irreversible-marker' => '{{optional}}',
'userrights-conflict' => "Shown on [[Special:UserRights]] if the target's rights have been changed since the form was loaded.",
'userrights-removed-self' => "Shown on [[Special:UserRights]] in a green box after the user removed its own rights to access that page.",
# Groups
'group' => '{{Identical|Group}}',

View file

@ -1137,6 +1137,7 @@ $wgMessageStructure = array(
'userrights-unchangeable-col',
'userrights-irreversible-marker',
'userrights-conflict',
'userrights-removed-self',
),
'group' => array(
'group',