Merge "SpecialUserrights: Use session data instead of URL parameter for success"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 15 Dec 2016 10:16:01 +0000 (10:16 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 15 Dec 2016 10:16:01 +0000 (10:16 +0000)
includes/specials/SpecialUserrights.php

index 1d9c057..df98f33 100644 (file)
@@ -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 ) {
@@ -103,7 +104,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(
@@ -171,6 +178,9 @@ class UserrightsPage extends SpecialPage {
                                        $targetUser
                                );
 
+                               // Set session data for the success message
+                               $session->set( 'specialUserrightsSaveSuccess', 1 );
+
                                $out->redirect( $this->getSuccessURL() );
 
                                return;
@@ -184,7 +194,7 @@ class UserrightsPage extends SpecialPage {
        }
 
        function getSuccessURL() {
-               return $this->getPageTitle( $this->mTarget )->getFullURL( [ 'success' => 1 ] );
+               return $this->getPageTitle( $this->mTarget )->getFullURL();
        }
 
        /**