Merge "Special:PagesWithProp: Do not show very long or binary values"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 23 Jul 2013 16:45:08 +0000 (16:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 23 Jul 2013 16:45:08 +0000 (16:45 +0000)
includes/api/ApiPageSet.php
includes/specials/SpecialFilepath.php
resources/jquery/jquery.tablesorter.js
tests/phpunit/includes/api/query/ApiQueryBasicTest.php

index 9fdad2b..b05cb2b 100644 (file)
@@ -152,7 +152,6 @@ class ApiPageSet extends ApiBase {
                        if ( !$isDryRun ) {
                                $generator->executeGenerator( $this );
                                wfRunHooks( 'APIQueryGeneratorAfterExecute', array( &$generator, &$this ) );
-                               $this->resolvePendingRedirects();
                        } else {
                                // Prevent warnings from being reported on these parameters
                                $main = $this->getMain();
@@ -163,6 +162,10 @@ class ApiPageSet extends ApiBase {
                        $generator->profileOut();
                        $this->profileIn();
 
+                       if ( !$isDryRun ) {
+                               $this->resolvePendingRedirects();
+                       }
+
                        if ( !$isQuery ) {
                                // If this pageset is not part of the query, we called profileIn() above
                                $dbSource->profileOut();
index 57e552b..e7ced52 100644 (file)
@@ -35,7 +35,8 @@ class SpecialFilepath extends RedirectSpecialPage {
 
        // implement by redirecting through Special:Redirect/file
        function getRedirect( $par ) {
-               return SpecialPage::getSafeTitleFor( 'Redirect', 'file/' . $par );
+               $file = $par ?: $this->getRequest()->getText( 'file' );
+               return SpecialPage::getSafeTitleFor( 'Redirect', 'file/' . $file );
        }
 
        protected function getGroupName() {
index d20d280..863d8ec 100644 (file)
                        }
 
                        if ( !this.sortDisabled ) {
-                               $( this ).addClass( table.config.cssHeader ).attr( 'title', msg[1] );
+                               $( this )
+                                       .addClass( table.config.cssHeader )
+                                       .attr( 'title', msg[1] )
+                                       .prop( 'tabIndex', 0 ).attr( 'role', 'button' );
                        }
 
                        // add cell to headerList
 
                                        // Apply event handling to headers
                                        // this is too big, perhaps break it out?
-                                       $headers.filter( ':not(.unsortable)' ).click( function ( e ) {
-                                               if ( e.target.nodeName.toLowerCase() === 'a' ) {
-                                                       // The user clicked on a link inside a table header
-                                                       // Do nothing and let the default link click action continue
+                                       $headers.filter( ':not(.unsortable)' ).on( 'keypress click', function ( e ) {
+                                               if ( e.type === 'click' && e.target.nodeName.toLowerCase() === 'a' ) {
+                                                       // The user clicked on a link inside a table header.
+                                                       // Do nothing and let the default link click action continue.
+                                                       return true;
+                                               }
+
+                                               if ( e.type === 'keypress' && e.which !== 13 ) {
+                                                       // Only handle keypresses on the "Enter" key.
                                                        return true;
                                                }
 
index 403034b..1a2aa83 100644 (file)
@@ -320,6 +320,32 @@ class ApiQueryBasicTest extends ApiQueryTestBase {
                        self::$categorymembers ) );
        }
 
+       /**
+        * Test bug 51821
+        */
+       public function testGeneratorRedirects() {
+               $this->editPage( 'AQBT-Target', 'test' );
+               $this->editPage( 'AQBT-Redir', '#REDIRECT [[AQBT-Target]]' );
+               $this->check( array(
+                       array( 'generator' => 'backlinks', 'gbltitle' => 'AQBT-Target', 'redirects' => '1' ),
+                       array(
+                               'redirects' => array(
+                                       array(
+                                               'from' => 'AQBT-Redir',
+                                               'to' => 'AQBT-Target',
+                                       )
+                               ),
+                               'pages' => array(
+                                       '6' => array(
+                                               'pageid' => 6,
+                                               'ns' => 0,
+                                               'title' => 'AQBT-Target',
+                                       )
+                               ),
+                       )
+               ) );
+       }
+
        /**
         * Recursively merges the expected values in the $item into the $all
         */