Merge "API: Add a 'known' property when missing-but-known titles are output"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 11 Oct 2016 17:44:28 +0000 (17:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 11 Oct 2016 17:44:28 +0000 (17:44 +0000)
24 files changed:
includes/api/ApiLogin.php
includes/content/WikiTextStructure.php
languages/Language.php
languages/classes/LanguageIu.php
languages/classes/LanguageRu.php
languages/classes/LanguageShi.php
languages/classes/LanguageTr.php
languages/messages/MessagesKn.php
languages/messages/MessagesNn.php
resources/src/jquery/jquery.makeCollapsible.js
resources/src/mediawiki.action/mediawiki.action.view.metadata.js
resources/src/mediawiki.skinning/elements.css
resources/src/mediawiki.special/mediawiki.special.apisandbox.css
resources/src/mediawiki.special/mediawiki.special.apisandbox.js
resources/src/mediawiki.ui/components/anchors.less
resources/src/mediawiki/mediawiki.experiments.js
resources/src/mediawiki/mediawiki.jqueryMsg.js
resources/src/mediawiki/mediawiki.js
resources/src/mediawiki/mediawiki.toc.js
tests/phpunit/includes/XmlSelectTest.php
tests/phpunit/includes/api/ApiLoginTest.php
tests/phpunit/includes/parser/PreprocessorTest.php
tests/phpunit/languages/classes/LanguageTrTest.php
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js

index 55edd99..6ac261d 100644 (file)
@@ -190,15 +190,6 @@ class ApiLogin extends ApiBase {
 
                                $result['lguserid'] = intval( $user->getId() );
                                $result['lgusername'] = $user->getName();
-
-                               // @todo: These are deprecated, and should be removed at some
-                               // point (1.28 at the earliest, and see T121527). They were ok
-                               // when the core cookie-based login was the only thing, but
-                               // CentralAuth broke that a while back and
-                               // SessionManager/AuthManager *really* break it.
-                               $result['lgtoken'] = $user->getToken();
-                               $result['cookieprefix'] = $this->getConfig()->get( 'CookiePrefix' );
-                               $result['sessionid'] = $session->getId();
                                break;
 
                        case 'NeedToken':
@@ -206,10 +197,6 @@ class ApiLogin extends ApiBase {
                                $this->setWarning( 'Fetching a token via action=login is deprecated. ' .
                                   'Use action=query&meta=tokens&type=login instead.' );
                                $this->logFeatureUsage( 'action=login&!lgtoken' );
-
-                               // @todo: See above about deprecation
-                               $result['cookieprefix'] = $this->getConfig()->get( 'CookiePrefix' );
-                               $result['sessionid'] = $session->getId();
                                break;
 
                        case 'WrongToken':
index fe12ff7..f4a6dc6 100644 (file)
@@ -77,7 +77,7 @@ class WikiTextStructure {
                        $heading = $heading[ 'line' ];
 
                        // Some wikis wrap the brackets in a span:
-                       // http://en.wikipedia.org/wiki/MediaWiki:Cite_reference_link
+                       // https://en.wikipedia.org/wiki/MediaWiki:Cite_reference_link
                        $heading = preg_replace( '/<\/?span>/', '', $heading );
                        // Normalize [] so the following regexp would work.
                        $heading = preg_replace( [ '/&#91;/', '/&#93;/' ], [ '[', ']' ], $heading );
index 3e28759..7354155 100644 (file)
@@ -291,7 +291,7 @@ class Language {
                # Since these are limited, this is safe even later changes to the registry --
                # the only oddity is that it might change the type of the tag, and thus
                # the results from the capturing groups.
-               # http://www.iana.org/assignments/language-subtag-registry
+               # https://www.iana.org/assignments/language-subtag-registry
 
                $grandfathered = "en{$s}GB{$s}oed"
                        . "|i{$s}(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)"
@@ -1623,7 +1623,7 @@ class Language {
         *
         * Based on a PHP-Nuke block by Sharjeel which is released under GNU/GPL license
         *
-        * @see http://phpnuke.org/modules.php?name=News&file=article&sid=8234&mode=thread&order=0&thold=0
+        * @see https://phpnuke.org/modules.php?name=News&file=article&sid=8234&mode=thread&order=0&thold=0
         *
         * @param string $ts
         *
@@ -1852,9 +1852,9 @@ class Language {
         * Algorithm to convert Gregorian dates to Thai solar dates,
         * Minguo dates or Minguo dates.
         *
-        * Link: http://en.wikipedia.org/wiki/Thai_solar_calendar
-        *       http://en.wikipedia.org/wiki/Minguo_calendar
-        *       http://en.wikipedia.org/wiki/Japanese_era_name
+        * Link: https://en.wikipedia.org/wiki/Thai_solar_calendar
+        *       https://en.wikipedia.org/wiki/Minguo_calendar
+        *       https://en.wikipedia.org/wiki/Japanese_era_name
         *
         * @param string $ts 14-character timestamp
         * @param string $cName Calender name
@@ -2593,7 +2593,7 @@ class Language {
        public function iconv( $in, $out, $string ) {
                # Even with //IGNORE iconv can whine about illegal characters in
                # *input* string. We just ignore those too.
-               # REF: http://bugs.php.net/bug.php?id=37166
+               # REF: https://bugs.php.net/bug.php?id=37166
                # REF: https://phabricator.wikimedia.org/T18885
                MediaWiki\suppressWarnings();
                $text = iconv( $in, $out . '//IGNORE', $string );
index 4003bdd..a2288d0 100644 (file)
@@ -28,7 +28,7 @@
  *
  *
  * Based on:
- *   - http://commons.wikimedia.org/wiki/Image:Inuktitut.png
+ *   - https://commons.wikimedia.org/wiki/Image:Inuktitut.png
  *   - LanguageSr.php
  *
  * @ingroup Language
index 60384a8..c2560a4 100644 (file)
@@ -70,7 +70,7 @@ class LanguageRu extends Language {
 
        /**
         * Four-digit number should be without group commas (spaces)
-        * See manual of style at http://ru.wikipedia.org/wiki/Википедия:Оформление_статей
+        * See manual of style at https://ru.wikipedia.org/wiki/Википедия:Оформление_статей
         * So "1 234 567", "12 345" but "1234"
         *
         * @param string $_
index 61aba70..0de396d 100644 (file)
@@ -28,7 +28,7 @@
  *
  *
  * Based on:
- *   - http://en.wikipedia.org/wiki/Shilha_language
+ *   - https://en.wikipedia.org/wiki/Shilha_language
  *   - LanguageSr.php
  *
  * @ingroup Language
index c947341..42ee44d 100644 (file)
@@ -27,7 +27,7 @@
  * Turkish has two different i, one with a dot and another without a dot. They
  * are totally different letters in this language, so we have to override the
  * ucfirst and lcfirst methods.
- * See http://en.wikipedia.org/wiki/Dotted_and_dotless_I
+ * See https://en.wikipedia.org/wiki/Dotted_and_dotless_I
  * and @bug 28040
  * @ingroup Language
  */
index 108f777..5d846ea 100644 (file)
@@ -7,11 +7,11 @@
  * @file
  *
  * @author Akoppad
- * @author Ashwath Mattur <ashwatham@gmail.com> http://en.wikipedia.org/wiki/User:Ashwatham
+ * @author Ashwath Mattur <ashwatham@gmail.com> https://en.wikipedia.org/wiki/User:Ashwatham
  * @author Dimension10
  * @author Dipin
  * @author HPN
- * @author Hari Prasad Nadig <hpnadig@gmail.com> http://en.wikipedia.org/wiki/User:Hpnadig
+ * @author Hari Prasad Nadig <hpnadig@gmail.com> https://en.wikipedia.org/wiki/User:Hpnadig
  * @author Kaganer
  * @author Ktkaushik
  * @author M G Harish
index b8ae8d7..5ceafd1 100644 (file)
@@ -38,8 +38,8 @@
  * @license http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
  *
- * @see http://meta.wikimedia.org/w/index.php?title=LanguageNn.php&action=history
- * @see http://nn.wikipedia.org/w/index.php?title=Brukar:Dittaeva/LanguageNn.php&action=history
+ * @see https://meta.wikimedia.org/w/index.php?title=LanguageNn.php&action=history
+ * @see https://nn.wikipedia.org/w/index.php?title=Brukar:Dittaeva/LanguageNn.php&action=history
  */
 
 $datePreferences = [
index ac60e8f..eef3846 100644 (file)
                        };
                        // Default toggle link. Only build it when needed to avoid jQuery memory leaks (event data).
                        buildDefaultToggleLink = function () {
-                               return $( '<a href="#"></a>' )
+                               return $( '<a>' )
+                                       .attr( {
+                                               role: 'button',
+                                               tabindex: 0
+                                       } )
                                        .text( collapseText )
                                        .wrap( '<span class="mw-collapsible-toggle"></span>' )
                                                .parent()
index 4c75e33..a3a82d5 100644 (file)
 
                $link = $( '<a>' )
                .text( showText )
-               .attr( 'href', '#' )
-               .click( function () {
-                       if ( $table.hasClass( 'collapsed' ) ) {
-                               $( this ).text( hideText );
-                       } else {
-                               $( this ).text( showText );
+               .attr( {
+                       role: 'button',
+                       tabindex: 0
+               } )
+               .on( 'click keypress', function ( e ) {
+                       if (
+                               e.type === 'click' ||
+                               e.type === 'keypress' && e.which === 13
+                       ) {
+                               if ( $table.hasClass( 'collapsed' ) ) {
+                                       $( this ).text( hideText );
+                               } else {
+                                       $( this ).text( showText );
+                               }
+                               $table.toggleClass( 'expanded collapsed' );
                        }
-                       $table.toggleClass( 'expanded collapsed' );
-                       return false;
                } );
 
                $col.append( $link );
index 7b0b071..5fbfb85 100644 (file)
@@ -11,6 +11,7 @@ a {
        text-decoration: none;
        color: #0645ad;
        background: none;
+       cursor: pointer; /* Always cursor:pointer even without href */
 }
 
 a:visited {
index 2517605..99f6c13 100644 (file)
        z-index: 100;
 }
 
+.mw-apisandbox-fullscreen .mw-apisandbox-container {
+       border-width: 1px 0 0 0;
+       border-radius: 0;
+}
+
 .mw-apisandbox-spacer {
        display: inline-block;
        height: 1px;
index 3959900..98ed3ee 100644 (file)
                init: function () {
                        var $toolbar;
 
+                       ApiSandbox.isFullscreen = false;
+
                        $content = $( '#mw-apisandbox' );
 
                        windowManager = new OO.ui.WindowManager();
                 * Toggle "fullscreen" mode
                 */
                toggleFullscreen: function () {
-                       var $body = $( document.body );
+                       var $body = $( document.body ),
+                               $ui = $( '#mw-apisandbox-ui' );
+
+                       ApiSandbox.isFullscreen = !ApiSandbox.isFullscreen;
 
-                       $body.toggleClass( 'mw-apisandbox-fullscreen' );
-                       if ( $body.hasClass( 'mw-apisandbox-fullscreen' ) ) {
+                       $body.toggleClass( 'mw-apisandbox-fullscreen', ApiSandbox.isFullscreen );
+                       $ui.toggleClass( 'mw-body-content', ApiSandbox.isFullscreen );
+                       if ( ApiSandbox.isFullscreen ) {
                                fullscreenButton.setLabel( mw.message( 'apisandbox-unfullscreen' ).text() );
                                fullscreenButton.setTitle( mw.message( 'apisandbox-unfullscreen-tooltip' ).text() );
-                               $body.append( $( '#mw-apisandbox-ui' ) );
+                               $body.append( $ui );
                        } else {
                                fullscreenButton.setLabel( mw.message( 'apisandbox-fullscreen' ).text() );
                                fullscreenButton.setTitle( mw.message( 'apisandbox-fullscreen-tooltip' ).text() );
-                               $content.append( $( '#mw-apisandbox-ui' ) );
+                               $content.append( $ui );
                        }
                        ApiSandbox.resizePanel();
                },
                        var height = $( window ).height(),
                                contentTop = $content.offset().top;
 
-                       if ( $( document.body ).hasClass( 'mw-apisandbox-fullscreen' ) ) {
+                       if ( ApiSandbox.isFullscreen ) {
                                height -= panel.$element.offset().top - $( '#mw-apisandbox-ui' ).offset().top;
                                panel.$element.height( height - 1 );
                        } else {
index 5bb69b8..4c4e129 100644 (file)
@@ -6,15 +6,14 @@
 .mixin-mw-ui-anchor-styles( @mainColor ) {
        color: @mainColor;
 
-       // Hover state
        &:hover {
                color: lighten( @mainColor, @colorLightenPercentage );
        }
-       // Focus and active states
+
        &:focus,
        &:active {
                color: darken( @mainColor, @colorDarkenPercentage );
-               outline: none; // outline fix
+               outline: 0;
        }
 
        // Quiet mode is gray at first
 /*
 Anchors
 
-The anchor base type can be applied to A elements when a basic context styling needs to be given to a link, without
-having to assign it as a button type. mw-ui-anchor only changes the text color, and should not be used in combination
-with other base classes, such as mw-ui-button.
+The anchor base type can be applied to `a` elements when a basic context styling needs to be given to a link, without
+having to assign it as a button type. `.mw-ui-anchor` only changes the text color, and should not be used in combination
+with other base classes, such as `.mw-ui-button`.
+
 
 Markup:
 <a href="#" class="mw-ui-anchor mw-ui-progressive">Progressive</a>
-<a href="#" class="mw-ui-anchor mw-ui-constructive">Constructive</a>
 <a href="#" class="mw-ui-anchor mw-ui-destructive">Destructive</a>
 
 .mw-ui-quiet - Quiet until interaction.
@@ -46,13 +45,14 @@ Styleguide 6.2.
                .mixin-mw-ui-anchor-styles( @colorProgressive );
        }
 
-       &.mw-ui-constructive {
-               .mixin-mw-ui-anchor-styles( @colorConstructive );
-       }
-
        &.mw-ui-destructive {
                .mixin-mw-ui-anchor-styles( @colorDestructive );
        }
+
+       //`.mw-ui-constructive` is deprecated; consolidated with `progressive`, see T110555
+       &.mw-ui-constructive {
+               .mixin-mw-ui-anchor-styles( @colorConstructive );
+       }
 }
 
 /*
index ad1069f..49ff411 100644 (file)
@@ -7,14 +7,14 @@
        /**
         * An implementation of Jenkins' one-at-a-time hash.
         *
-        * @see http://en.wikipedia.org/wiki/Jenkins_hash_function
+        * @see https://en.wikipedia.org/wiki/Jenkins_hash_function
         *
         * @param {string} string String to hash
         * @return {number} The hash as a 32-bit unsigned integer
         * @ignore
         *
         * @author Ori Livneh <ori@wikimedia.org>
-        * @see http://jsbin.com/kejewi/4/watch?js,console
+        * @see https://jsbin.com/kejewi/4/watch?js,console
         */
        function hashString( string ) {
                var hash = 0,
index 44b9117..2646cff 100644 (file)
                        } else {
                                $el = $( '<a>' );
                                if ( typeof arg === 'function' ) {
-                                       $el.attr( 'href', '#' )
-                                       .click( function ( e ) {
-                                               e.preventDefault();
+                                       $el.attr( {
+                                               role: 'button',
+                                               tabindex: 0
                                        } )
-                                       .click( arg );
+                                       .on( 'click keypress', function ( e ) {
+                                               if (
+                                                       e.type === 'click' ||
+                                                       e.type === 'keypress' && e.which === 13
+                                               ) {
+                                                       arg.call( this, e );
+                                               }
+                                       } );
                                } else {
                                        $el.attr( 'href', textify( arg ) );
                                }
index 2750765..f878e42 100644 (file)
                                logged.add( trace );
                                return true;
                        }
-                       Object.defineProperty( obj, key, {
-                               configurable: true,
-                               enumerable: true,
-                               get: function () {
-                                       if ( uniqueTrace() ) {
-                                               mw.track( 'mw.deprecate', key );
-                                               mw.log.warn( msg );
-                                       }
-                                       return val;
-                               },
-                               set: function ( newVal ) {
-                                       if ( uniqueTrace() ) {
-                                               mw.track( 'mw.deprecate', key );
-                                               mw.log.warn( msg );
+                       // Support: Safari 5.0
+                       // Throws "not supported on DOM Objects" for Node or Element objects (incl. document)
+                       // Safari 4.0 doesn't have this method, and it was fixed in Safari 5.1.
+                       try {
+                               Object.defineProperty( obj, key, {
+                                       configurable: true,
+                                       enumerable: true,
+                                       get: function () {
+                                               if ( uniqueTrace() ) {
+                                                       mw.track( 'mw.deprecate', key );
+                                                       mw.log.warn( msg );
+                                               }
+                                               return val;
+                                       },
+                                       set: function ( newVal ) {
+                                               if ( uniqueTrace() ) {
+                                                       mw.track( 'mw.deprecate', key );
+                                                       mw.log.warn( msg );
+                                               }
+                                               val = newVal;
                                        }
-                                       val = newVal;
-                               }
-                       } );
-
+                               } );
+                       } catch ( err ) {
+                               obj[ key ] = val;
+                       }
                };
 
                return log;
index 7bf73b6..0955c23 100644 (file)
@@ -10,8 +10,7 @@
                $tocList = $toc.find( 'ul' ).eq( 0 );
 
                // Hide/show the table of contents element
-               function toggleToc( e ) {
-                       e.preventDefault();
+               function toggleToc() {
                        if ( $tocList.is( ':hidden' ) ) {
                                $tocList.slideDown( 'fast' );
                                $tocToggleLink.text( mw.msg( 'hidetoc' ) );
                if ( $toc.length && $tocTitle.length && $tocList.length && !$tocToggleLink.length ) {
                        hideToc = mw.cookie.get( 'hidetoc' ) === '1';
 
-                       $tocToggleLink = $( '<a href="#" id="togglelink"></a>' )
+                       $tocToggleLink = $( '<a role="button" tabindex="0" id="togglelink"></a>' )
                                .text( mw.msg( hideToc ? 'showtoc' : 'hidetoc' ) )
-                               .click( toggleToc );
+                               .on( 'click keypress', function ( e ) {
+                                       if (
+                                               e.type === 'click' ||
+                                               e.type === 'keypress' && e.which === 13
+                                       ) {
+                                               toggleToc();
+                                       }
+                               } );
 
                        $tocTitle.append(
                                $tocToggleLink
index f80f512..52e20bd 100644 (file)
@@ -50,7 +50,7 @@ class XmlSelectTest extends MediaWikiTestCase {
                        /**
                         * Values are set following a 3-bit Gray code where two successive
                         * values differ by only one value.
-                        * See http://en.wikipedia.org/wiki/Gray_code
+                        * See https://en.wikipedia.org/wiki/Gray_code
                         */
                        #      $name   $id    $default
                        [ false, false, false, '<select></select>' ],
index 97681eb..ea8c9ca 100644 (file)
@@ -188,7 +188,6 @@ class ApiLoginTest extends ApiTestCase {
                $this->assertArrayHasKey( "login", $data[0] );
                $this->assertArrayHasKey( "result", $data[0]['login'] );
                $this->assertEquals( "Success", $data[0]['login']['result'] );
-               $this->assertArrayHasKey( 'lgtoken', $data[0]['login'] );
        }
 
        public function testBotPassword() {
index 6710b19..c491e6b 100644 (file)
@@ -210,10 +210,10 @@ class PreprocessorTest extends MediaWikiTestCase {
        public static function provideFiles() {
                // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                return self::addClassArg( [
-                       [ "QuoteQuran" ], # http://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC BY-SA by Striver
-                       [ "Factorial" ], # http://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC BY-SA by Polonium
-                       [ "All_system_messages" ], # http://tl.wiktionary.org/w/index.php?title=Suleras:All_system_messages&oldid=2765 GPL text generated by MediaWiki
-                       [ "Fundraising" ], # http://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC BY-SA, copied there by Sky Harbor.
+                       [ "QuoteQuran" ], # https://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC BY-SA by Striver
+                       [ "Factorial" ], # https://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC BY-SA by Polonium
+                       [ "All_system_messages" ], # https://tl.wiktionary.org/w/index.php?title=Suleras:All_system_messages&oldid=2765 GPL text generated by MediaWiki
+                       [ "Fundraising" ], # https://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC BY-SA, copied there by Sky Harbor.
                        [ "NestedTemplates" ], # bug 27936
                ] );
                // @codingStandardsIgnoreEnd
index 206e608..9a1823b 100644 (file)
@@ -14,7 +14,7 @@ class LanguageTrTest extends LanguageClassesTestCase {
         *  - berm
         *  - []LuCkY[]
         *  - Emperyan
-        * @see http://en.wikipedia.org/wiki/Dotted_and_dotless_I
+        * @see https://en.wikipedia.org/wiki/Dotted_and_dotless_I
         * @dataProvider provideDottedAndDotlessI
         * @covers Language::ucfirst
         * @covers Language::lcfirst
@@ -49,7 +49,7 @@ class LanguageTrTest extends LanguageClassesTestCase {
                        [ 'lcfirst', 'i', 'lower', 'i' ],
 
                        # A real example taken from bug 28040 using
-                       # http://tr.wikipedia.org/wiki/%C4%B0Phone
+                       # https://tr.wikipedia.org/wiki/%C4%B0Phone
                        [ 'lcfirst', 'iPhone', 'lower', 'iPhone' ],
 
                        # next case is valid in Turkish but are different words if we
index 7133039..caaef83 100644 (file)
                );
                assert.htmlEqual(
                        formatParse( 'external-link-replace', function () {} ),
-                       'Foo <a href="#">bar</a>',
+                       'Foo <a role="button" tabindex="0">bar</a>',
                        'External link message processed as function when format is \'parse\''
                );