Merge "Simplify checking for widgets on special block page"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 11 Apr 2019 09:29:16 +0000 (09:29 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 11 Apr 2019 09:29:16 +0000 (09:29 +0000)
1  2 
includes/specials/SpecialBlock.php
resources/Resources.php

@@@ -141,7 -141,9 +141,9 @@@ class SpecialBlock extends FormSpecialP
         * @return array
         */
        protected function getFormFields() {
-               global $wgBlockAllowsUTEdit;
+               $conf = $this->getConfig();
+               $enablePartialBlocks = $conf->get( 'EnablePartialBlocks' );
+               $blockAllowsUTEdit = $conf->get( 'BlockAllowsUTEdit' );
  
                $this->getOutput()->enableOOUI();
  
  
                $suggestedDurations = self::getSuggestedDurations();
  
-               $conf = $this->getConfig();
-               $enablePartialBlocks = $conf->get( 'EnablePartialBlocks' );
                $a = [];
  
                $a['Target'] = [
                        ];
                }
  
-               if ( $wgBlockAllowsUTEdit ) {
+               if ( $blockAllowsUTEdit ) {
                        $a['DisableUTEdit'] = [
                                'type' => 'check',
                                'label-message' => 'ipb-disableusertalk',
         *     the HTMLForm
         * @param WebRequest|null $request Optionally try and get data from a request too
         * @return array [ User|string|null, Block::TYPE_ constant|null ]
 +       * @phan-return array{0:User|string|null,1:int|null}
         */
        public static function getTargetAndType( $par, WebRequest $request = null ) {
                $i = 0;
diff --combined resources/Resources.php
@@@ -27,6 -27,12 +27,6 @@@ if ( !defined( 'MEDIAWIKI' ) ) 
  global $wgResourceBasePath;
  
  return [
 -
 -      /**
 -       * Special modules who have their own classes
 -       */
 -      'startup' => [ 'class' => ResourceLoaderStartUpModule::class ],
 -
        // Scripts managed by the local wiki (stored in the MediaWiki namespace)
        'site' => [ 'class' => ResourceLoaderSiteModule::class ],
        'site.styles' => [ 'class' => ResourceLoaderSiteStylesModule::class ],
                ],
        ],
        'mediawiki.action.history' => [
 +              'dependencies' => [ 'jquery.makeCollapsible' ],
                'scripts' => 'resources/src/mediawiki.action/mediawiki.action.history.js',
                'styles' => 'resources/src/mediawiki.action/mediawiki.action.history.css',
        ],
        'mediawiki.action.history.styles' => [
                'skinStyles' => [
 -                      'default' => 'resources/src/mediawiki.action/mediawiki.action.history.styles.css',
 +                      'default' => 'resources/src/mediawiki.action/mediawiki.action.history.styles.less',
                ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
                ],
        ],
        'mediawiki.special.block' => [
-               'scripts' => 'resources/src/mediawiki.special.block.js',
+               'localBasePath' => "$IP/resources/src",
+               'remoteBasePath' => "$wgResourceBasePath/resources/src",
+               'packageFiles' => [
+                       'mediawiki.special.block.js',
+                       [ 'name' => 'config.json', 'config' => [
+                               'EnablePartialBlocks',
+                               'BlockAllowsUTEdit',
+                       ] ],
+               ],
                'dependencies' => [
                        'oojs-ui-core',
                        'oojs-ui.styles.icons-editing-core',