mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 17:00:37 +00:00
Improve how we render help messages in preferences
* The 'help' parameter expects a string, not a Message object. It seemed to be working, but caused fatals when switching the preferences form to the OOUI implementation (T117781). * Use 'help-message' instead, which also avoids using the global request context for Message objects. Bug: T117781 Change-Id: I5b2e44df35a2696da0e7ba8394eccf41914f6dda
This commit is contained in:
parent
dfad838fa7
commit
2b637e42ef
|
@ -76,7 +76,7 @@ class PopupsHooks {
|
||||||
$option = [
|
$option = [
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'label-message' => 'popups-prefs-optin-title',
|
'label-message' => 'popups-prefs-optin-title',
|
||||||
'help' => wfMessage( 'popups-prefs-conflicting-gadgets-info' ),
|
'help-message' => 'popups-prefs-conflicting-gadgets-info',
|
||||||
'options' => [
|
'options' => [
|
||||||
wfMessage( 'popups-prefs-optin-enabled-label' )->text()
|
wfMessage( 'popups-prefs-optin-enabled-label' )->text()
|
||||||
=> PopupsContext::PREVIEWS_ENABLED,
|
=> PopupsContext::PREVIEWS_ENABLED,
|
||||||
|
@ -87,8 +87,8 @@ class PopupsHooks {
|
||||||
];
|
];
|
||||||
if ( $context->conflictsWithNavPopupsGadget( $user ) ) {
|
if ( $context->conflictsWithNavPopupsGadget( $user ) ) {
|
||||||
$option[ 'disabled' ] = true;
|
$option[ 'disabled' ] = true;
|
||||||
$option[ 'help' ] = wfMessage( 'popups-prefs-disable-nav-gadgets-info',
|
$option[ 'help-message' ] = [ 'popups-prefs-disable-nav-gadgets-info',
|
||||||
'Special:Preferences#mw-prefsection-gadgets' );
|
'Special:Preferences#mw-prefsection-gadgets' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
$skinPosition = array_search( 'skin', array_keys( $prefs ) );
|
$skinPosition = array_search( 'skin', array_keys( $prefs ) );
|
||||||
|
|
|
@ -105,7 +105,7 @@ class PopupsHooksTest extends MediaWikiTestCase {
|
||||||
$prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ] );
|
$prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ] );
|
||||||
$this->assertEquals( true,
|
$this->assertEquals( true,
|
||||||
$prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME]['disabled'] );
|
$prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME]['disabled'] );
|
||||||
$this->assertNotEmpty( $prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME]['help'] );
|
$this->assertNotEmpty( $prefs[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME]['help-message'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue