$res = self::tryFormSubmit( $formData, $form );
if ( $res ) {
- $urlOptions = array( 'success' => 1 );
+ $urlOptions = array();
if ( $res === 'eauth' ) {
$urlOptions['eauth'] = 1;
$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();
$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',
$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;
notif = null;
}
} );
-
- // 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/, '' ) );
- }
}
}