The check for type Array of the JavaScript config variable is obsolete.
Change-Id: I4a38cfc211360c831958ce8ca88584cdf56a727c
$user = $context->getUser();
$output = $context->getOutput();
$lang = $context->getLanguage();
- $conf = $context->getConfig();
- $cascadingRestrictionLevels = $conf->get( 'CascadingRestrictionLevels' );
$out = '';
if ( !$this->disabled ) {
$output->addModules( 'mediawiki.legacy.protect' );
- $output->addJsConfigVars( 'wgCascadeableLevels', $cascadingRestrictionLevels );
$out .= Xml::openElement( 'form', [ 'method' => 'post',
'action' => $this->mTitle->getLocalURL( 'action=protect' ),
'id' => 'mw-Protect-Form' ] );
],
],
'mediawiki.legacy.protect' => [
- 'scripts' => 'resources/src/mediawiki.legacy/protect.js',
+ 'localBasePath' => "$IP/resources/src/mediawiki.legacy",
+ 'remoteBasePath' => "$wgResourceBasePath/resources/src/mediawiki.legacy",
+ 'packageFiles' => [
+ 'protect.js',
+ 'config.json' => [ 'config' => [ 'CascadingRestrictionLevels' ] ],
+ ],
'dependencies' => 'jquery.lengthLimit',
'messages' => [ 'protect-unchain-permissions' ]
],
( function () {
var ProtectionForm,
+ config = require( './config.json' ),
reasonCodePointLimit = mw.config.get( 'wgCommentCodePointLimit' ),
reasonByteLimit = mw.config.get( 'wgCommentByteLimit' );
return false;
}
- if ( mw.config.get( 'wgCascadeableLevels' ) !== undefined ) {
- $( 'form#mw-Protect-Form' ).on( 'submit', this.toggleUnchainedInputs.bind( ProtectionForm, true ) );
- }
+ $( 'form#mw-Protect-Form' ).on( 'submit', this.toggleUnchainedInputs.bind( ProtectionForm, true ) );
this.getExpirySelectors().each( function () {
$( this ).on( 'change', ProtectionForm.updateExpiryList.bind( ProtectionForm, this ) );
} );
* @return {boolean}
*/
isCascadeableLevel: function ( level ) {
- var cascadeableLevels = mw.config.get( 'wgCascadeableLevels' );
-
- if ( !Array.isArray( cascadeableLevels ) ) {
- return false;
- }
-
- return cascadeableLevels.indexOf( level ) !== -1;
+ return config.CascadingRestrictionLevels.indexOf( level ) !== -1;
},
/**