Merge "Add userToolLinks on Special:FileDuplicateSearch"
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 13 Jul 2012 18:30:16 +0000 (18:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 13 Jul 2012 18:30:16 +0000 (18:30 +0000)
includes/specials/SpecialFileDuplicateSearch.php

index 18d19db..f8e40e0 100644 (file)
@@ -157,10 +157,24 @@ class FileDuplicateSearchPage extends QueryPage {
                                );
                        }
 
+                       $this->doBatchLookups( $dupes );
                        $this->showList( $dupes );
                }
        }
 
+       function doBatchLookups( $list ) {
+               $batch = new LinkBatch();
+               foreach( $list as $file ) {
+                       $batch->addObj( $file->getTitle() );
+                       if( $file->isLocal() ) {
+                               $userName = $file->getUser( 'text' );
+                               $batch->add( NS_USER, $userName );
+                               $batch->add( NS_USER_TALK, $userName );
+                       }
+               }
+               $batch->execute();
+       }
+
        /**
         *
         * @param Skin $skin
@@ -178,7 +192,17 @@ class FileDuplicateSearchPage extends QueryPage {
                );
 
                $userText = $result->getUser( 'text' );
-               $user = Linker::link( Title::makeTitle( NS_USER, $userText ), $userText );
+               if ( $result->isLocal() ) {
+                       $userId = $result->getUser( 'id' );
+                       $user = Linker::userLink( $userId, $userText );
+                       $user .= $this->getContext()->msg( 'word-separator' )->plain();
+                       $user .= '<span style="white-space: nowrap;">';
+                       $user .= Linker::userToolLinks( $userId, $userText );
+                       $user .= '</span>';
+               } else {
+                       $user = htmlspecialchars( $userText );
+               }
+
                $time = $this->getLanguage()->userTimeAndDate( $result->getTimestamp(), $this->getUser() );
 
                return "$plink . . $user . . $time";