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' ] );