Merge "API: Some raw message cleanup"
[lhc/web/wiklou.git] / includes / specials / SpecialPreferences.php
index 7f257e6..f00477f 100644 (file)
@@ -57,24 +57,29 @@ class SpecialPreferences extends SpecialPage {
                if ( $request->getSessionData( 'specialPreferencesSaveSuccess' ) ) {
                        // Remove session data for the success message
                        $request->setSessionData( 'specialPreferencesSaveSuccess', null );
+                       $out->addModuleStyles( 'mediawiki.notification.convertmessagebox.styles' );
 
-                       $out->wrapWikiMsg(
+                       $out->addHtml(
                                Html::rawElement(
                                        'div',
                                        [
-                                               'class' => 'mw-preferences-messagebox successbox',
-                                               'id' => 'mw-preferences-success'
+                                               'class' => 'mw-preferences-messagebox mw-notify-success successbox',
+                                               'id' => 'mw-preferences-success',
+                                               'data-mw-autohide' => 'false',
                                        ],
-                                       Html::element( 'p', [], '$1' )
-                               ),
-                               'savedprefs'
+                                       Html::element( 'p', [], $this->msg( 'savedprefs' )->text() )
+                               )
                        );
                }
 
                $this->addHelpLink( 'Help:Preferences' );
 
                // Load the user from the master to reduce CAS errors on double post (T95839)
-               $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser();
+               if ( $this->getRequest()->wasPosted() ) {
+                       $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser();
+               } else {
+                       $user = $this->getUser();
+               }
 
                $htmlForm = Preferences::getFormObject( $user, $this->getContext() );
                $htmlForm->setSubmitCallback( [ 'Preferences', 'tryUISubmit' ] );