Use field name for the hide-if statement

Field name without 'wp' prefix (which is used as the key in html descriptor) is required.
After I58f9df384df8ecc5ebae8cac68ec2251351bc984, values of fields that are supposed to be disabled would be loaded from default, use a miss-matched field name would be treated as disabled.
It works in UI now, but it's not a good idea to strip the 'wp' prefix on the server-side.

Bug: T298819
Change-Id: If98368ad400986afaef3187867f201044ebf0efb
This commit is contained in:
Func 2022-01-16 13:01:54 +00:00
parent 7368a7d6e1
commit 0bd3a30343
3 changed files with 4 additions and 4 deletions

View File

@ -428,8 +428,8 @@ class Hooks {
// Only show this section when the Vector skin is checked. The JavaScript client also uses
// this state to determine whether to show or hide the whole section.
// If migration mode is enabled, the section is always hidden.
'hide-if' => self::isMigrationMode() ? [ '!==', 'wpskin', '0' ] :
[ '!==', 'wpskin', Constants::SKIN_NAME_LEGACY ],
'hide-if' => self::isMigrationMode() ? [ '!==', 'skin', '0' ] :
[ '!==', 'skin', Constants::SKIN_NAME_LEGACY ],
],
Constants::PREF_KEY_SIDEBAR_VISIBLE => [
'type' => 'api',

View File

@ -72,7 +72,7 @@ class HTMLLegacySkinVersionFieldTest extends \MediaWikiIntegrationTestCase {
'label-message' => 'prefs-vector-enable-vector-1-label',
'help-message' => 'prefs-vector-enable-vector-1-help',
'default' => true,
'hide-if' => [ '!==', 'wpskin', Constants::SKIN_NAME_LEGACY ],
'hide-if' => [ '!==', 'skin', Constants::SKIN_NAME_LEGACY ],
];
$skinVersionField = new HTMLLegacySkinVersionField( $params );
$checkField = new \HTMLCheckField( $params );

View File

@ -17,7 +17,7 @@ use Vector\HTMLForm\Fields\HTMLLegacySkinVersionField;
* @coversDefaultClass \Vector\Hooks
*/
class VectorHooksTest extends MediaWikiIntegrationTestCase {
private const HIDE_IF = [ '!==', 'wpskin', Constants::SKIN_NAME_LEGACY ];
private const HIDE_IF = [ '!==', 'skin', Constants::SKIN_NAME_LEGACY ];
private const SKIN_PREFS_SECTION = 'rendering/skin/skin-prefs';