The session data gets set in the POST and gets deleted 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.
The URL manipulation in mediawiki.special.preferences.js is superfluous.
Bug: T26700
Change-Id: I1c2b011e7a66b2b9379dd4a3fdcc6f978dd43b52
$res = self::tryFormSubmit( $formData, $form );
if ( $res ) {
$res = self::tryFormSubmit( $formData, $form );
if ( $res ) {
- $urlOptions = array( 'success' => 1 );
if ( $res === 'eauth' ) {
$urlOptions['eauth'] = 1;
if ( $res === 'eauth' ) {
$urlOptions['eauth'] = 1;
$url = $form->getTitle()->getFullURL( $urlOptions );
$url = $form->getTitle()->getFullURL( $urlOptions );
- $form->getContext()->getOutput()->redirect( $url );
+ $context = $form->getContext();
+ // Set session data for the success message
+ $context->getRequest()->setSessionData( 'specialPreferencesSaveSuccess', 1 );
+
+ $context->getOutput()->redirect( $url );
}
return Status::newGood();
}
return Status::newGood();
$out->addModules( 'mediawiki.special.preferences' );
$out->addModuleStyles( 'mediawiki.special.preferences.styles' );
$out->addModules( 'mediawiki.special.preferences' );
$out->addModuleStyles( 'mediawiki.special.preferences.styles' );
- if ( $this->getRequest()->getCheck( 'success' ) ) {
+ $request = $this->getRequest();
+ if ( $request->getSessionData( 'specialPreferencesSaveSuccess' ) ) {
+ // Remove session data for the success message
+ $request->setSessionData( 'specialPreferencesSaveSuccess', null );
+
$out->wrapWikiMsg(
Html::rawElement(
'div',
$out->wrapWikiMsg(
Html::rawElement(
'div',
$user->resetOptions( 'all', $this->getContext() );
$user->saveSettings();
$user->resetOptions( 'all', $this->getContext() );
$user->saveSettings();
- $url = $this->getPageTitle()->getFullURL( 'success' );
+ // Set session data for the success message
+ $this->getRequest()->setSessionData( 'specialPreferencesSaveSuccess', 1 );
+ $url = $this->getPageTitle()->getFullURL();
$this->getOutput()->redirect( $url );
return true;
$this->getOutput()->redirect( $url );
return true;
-
- // Remove now-unnecessary success=1 querystring to prevent reappearance of notification on reload
- if ( history.replaceState ) {
- history.replaceState( {}, document.title, location.href.replace( /&?success=1/, '' ) );
- }