Merge "Enable save button when removing item from UsersMultiselectWidget list"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 5 Sep 2017 16:00:51 +0000 (16:00 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 5 Sep 2017 16:00:51 +0000 (16:00 +0000)
RELEASE-NOTES-1.30
includes/EditPage.php
includes/diff/DifferenceEngine.php
includes/libs/virtualrest/RestbaseVirtualRESTService.php
resources/src/mediawiki/mediawiki.js

index 93d52b8..fb69bfd 100644 (file)
@@ -191,6 +191,8 @@ changes to languages because of Phabricator reports.
 * EditPage::isOouiEnabled() is deprecated and will always return true.
 * EditPage::getSummaryInput() and ::getSummaryInputOOUI() are deprecated. Please
   use ::getSummaryInputWidget() instead.
+* EditPage::getCheckboxes() and ::getCheckboxesOOUI() are deprecated. Please
+  use ::getCheckboxesWidget() instead.
 * Parser::getRandomString() (deprecated in 1.26) was removed.
 * Parser::uniqPrefix() (deprecated in 1.26) was removed.
 * Parser::extractTagsAndParams() now only accepts three arguments. The fourth,
index 9d2d402..d1e9435 100644 (file)
@@ -3593,7 +3593,7 @@ class EditPage {
                        $wgOut->addHTML( $this->getSummaryPreview( false, $this->summary ) );
                }
 
-               $checkboxes = $this->getCheckboxesOOUI(
+               $checkboxes = $this->getCheckboxesWidget(
                        $tabindex,
                        [ 'minor' => $this->minoredit, 'watch' => $this->watchthis ]
                );
@@ -4181,6 +4181,7 @@ class EditPage {
         * Returns an array of html code of the following checkboxes old style:
         * minor and watch
         *
+        * @deprecated since 1.30 Use getCheckboxesWidget() or getCheckboxesDefinition() instead
         * @param int &$tabindex Current tabindex
         * @param array $checked See getCheckboxesDefinition()
         * @return array
@@ -4236,21 +4237,34 @@ class EditPage {
        }
 
        /**
-        * Returns an array of html code of the following checkboxes:
-        * minor and watch
+        * Returns an array of checkboxes for the edit form, including 'minor' and 'watch' checkboxes and
+        * any other added by extensions.
         *
+        * @deprecated since 1.30 Use getCheckboxesWidget() or getCheckboxesDefinition() instead
         * @param int &$tabindex Current tabindex
         * @param array $checked Array of checkbox => bool, where bool indicates the checked
         *                 status of the checkbox
         *
-        * @return array
+        * @return array Associative array of string keys to OOUI\FieldLayout instances
         */
        public function getCheckboxesOOUI( &$tabindex, $checked ) {
+               return $this->getCheckboxesWidget( $tabindex, $checked );
+       }
+
+       /**
+        * Returns an array of checkboxes for the edit form, including 'minor' and 'watch' checkboxes and
+        * any other added by extensions.
+        *
+        * @param int &$tabindex Current tabindex
+        * @param array $checked Array of checkbox => bool, where bool indicates the checked
+        *                 status of the checkbox
+        *
+        * @return array Associative array of string keys to OOUI\FieldLayout instances
+        */
+       public function getCheckboxesWidget( &$tabindex, $checked ) {
                $checkboxes = [];
                $checkboxesDef = $this->getCheckboxesDefinition( $checked );
 
-               $origTabindex = $tabindex;
-
                foreach ( $checkboxesDef as $name => $options ) {
                        $legacyName = isset( $options['legacy-name'] ) ? $options['legacy-name'] : $name;
 
@@ -4286,7 +4300,19 @@ class EditPage {
                // Backwards-compatibility hack to run the EditPageBeforeEditChecks hook. It's important,
                // people have used it for the weirdest things completely unrelated to checkboxes...
                // And if we're gonna run it, might as well allow its legacy checkboxes to be shown.
-               $legacyCheckboxes = $this->getCheckboxes( $origTabindex, $checked );
+               $legacyCheckboxes = [];
+               if ( !$this->isNew ) {
+                       $legacyCheckboxes['minor'] = '';
+               }
+               $legacyCheckboxes['watch'] = '';
+               // Copy new-style checkboxes into an old-style structure
+               foreach ( $checkboxes as $name => $oouiLayout ) {
+                       $legacyCheckboxes[$name] = (string)$oouiLayout;
+               }
+               // Avoid PHP 7.1 warning of passing $this by reference
+               $ep = $this;
+               Hooks::run( 'EditPageBeforeEditChecks', [ &$ep, &$legacyCheckboxes, &$tabindex ], '1.29' );
+               // Copy back any additional old-style checkboxes into the new-style structure
                foreach ( $legacyCheckboxes as $name => $html ) {
                        if ( $html && !isset( $checkboxes[$name] ) ) {
                                $checkboxes[$name] = new OOUI\Widget( [ 'content' => new OOUI\HtmlSnippet( $html ) ] );
index 7f9af60..34f2852 100644 (file)
@@ -918,7 +918,7 @@ class DifferenceEngine extends ContextSource {
                        $wikidiff2Version = phpversion( 'wikidiff2' );
                        if (
                                $wikidiff2Version !== false &&
-                               version_compare( $wikidiff2Version, '0.3.0', '>=' )
+                               version_compare( $wikidiff2Version, '0.3', '>=' )
                        ) {
                                $text = wikidiff2_do_diff(
                                        $otext,
index 35c45de..90865ff 100644 (file)
@@ -61,11 +61,9 @@ class RestbaseVirtualRESTService extends VirtualRESTService {
                        'fixedUrl' => false,
                ], $params );
                // Ensure that the url parameter has a trailing slash.
-               $mparams['url'] = preg_replace(
-                       '#/?$#',
-                       '/',
-                       $mparams['url']
-               );
+               if ( substr( $mparams['url'], -1 ) !== '/' ) {
+                       $mparams['url'] .= '/';
+               }
                // Ensure the correct domain format: strip protocol, port,
                // and trailing slash if present.  This lets us use
                // $wgCanonicalServer as a default value, which is very convenient.
index c5989c0..fc930ca 100644 (file)
                        msg += ( e ? ':' : '.' );
                        console.log( msg );
 
-                       // If we have an exception object, log it to the error channel to trigger
-                       // proper stacktraces in browsers that support it. No fallback as we have
-                       // no browsers that don't support error(), but do support log().
-                       if ( e && console.error ) {
-                               console.error( String( e ), e );
+                       // If we have an exception object, log it to the warning channel to trigger
+                       // proper stacktraces in browsers that support it.
+                       if ( e && console.warn ) {
+                               console.warn( String( e ), e );
                        }
                }
                /* eslint-enable no-console */