From: Fomafix Date: Sun, 27 Dec 2015 16:46:17 +0000 (+0000) Subject: SpecialUserrights: Use session data instead of URL parameter for success X-Git-Tag: 1.31.0-rc.0~4578^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=2fcd22493d517276a86b674efb0cafb5a0c7fbfc;p=lhc%2Fweb%2Fwiklou.git SpecialUserrights: Use session data instead of URL parameter for success The session data gets set in the POST and gets removed in the GET. This change avoids changing the URL for the success message. A reload of the page does not show the success message again. Bug: T60492 Change-Id: Iac8d4e6adc4dc93a3da645485f18770fcd2b3872 --- diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 6ded6d9dd7..89dcdad513 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -76,6 +76,7 @@ class UserrightsPage extends SpecialPage { public function execute( $par ) { $user = $this->getUser(); $request = $this->getRequest(); + $session = $request->getSession(); $out = $this->getOutput(); if ( $par !== null ) { @@ -99,7 +100,13 @@ class UserrightsPage extends SpecialPage { } // show a successbox, if the user rights was saved successfully - if ( $request->getCheck( 'success' ) && $this->mFetchedUser !== null ) { + if ( + $session->get( 'specialUserrightsSaveSuccess' ) && + $this->mFetchedUser !== null + ) { + // Remove session data for the success message + $session->remove( 'specialUserrightsSaveSuccess' ); + $out->addModules( [ 'mediawiki.special.userrights' ] ); $out->addModuleStyles( 'mediawiki.notification.convertmessagebox.styles' ); $out->addHTML( @@ -167,6 +174,9 @@ class UserrightsPage extends SpecialPage { $targetUser ); + // Set session data for the success message + $session->set( 'specialUserrightsSaveSuccess', 1 ); + $out->redirect( $this->getSuccessURL() ); return; @@ -180,7 +190,7 @@ class UserrightsPage extends SpecialPage { } function getSuccessURL() { - return $this->getPageTitle( $this->mTarget )->getFullURL( [ 'success' => 1 ] ); + return $this->getPageTitle( $this->mTarget )->getFullURL(); } /**