jenkins-bot has submitted this change and it was merged.
Change subject: Preferences: Use session data instead of URL parameter for
success
......................................................................
Preferences: Use session data instead of URL parameter for success
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
---
M includes/Preferences.php
M includes/specials/SpecialPreferences.php
M resources/src/mediawiki.special/mediawiki.special.preferences.js
3 files changed, 14 insertions(+), 9 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Preferences.php b/includes/Preferences.php
index ad25fa8..5f37e3f 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -1470,7 +1470,7 @@
$res = self::tryFormSubmit( $formData, $form );
if ( $res ) {
- $urlOptions = array( 'success' => 1 );
+ $urlOptions = array();
if ( $res === 'eauth' ) {
$urlOptions['eauth'] = 1;
@@ -1480,7 +1480,11 @@
$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();
diff --git a/includes/specials/SpecialPreferences.php
b/includes/specials/SpecialPreferences.php
index b45946f..3fa5fd5 100644
--- a/includes/specials/SpecialPreferences.php
+++ b/includes/specials/SpecialPreferences.php
@@ -49,7 +49,11 @@
$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',
@@ -132,8 +136,10 @@
$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;
diff --git a/resources/src/mediawiki.special/mediawiki.special.preferences.js
b/resources/src/mediawiki.special/mediawiki.special.preferences.js
index c2b9a4f..92064a6 100644
--- a/resources/src/mediawiki.special/mediawiki.special.preferences.js
+++ b/resources/src/mediawiki.special/mediawiki.special.preferences.js
@@ -94,11 +94,6 @@
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/, '' ) );
- }
}
}
--
To view, visit https://gerrit.wikimedia.org/r/261033
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1c2b011e7a66b2b9379dd4a3fdcc6f978dd43b52
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Fomafix
Gerrit-Reviewer: Gerrit Patch Uploader <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Sn1per <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits