InfoAction: Don't pass non-dbkeys to LinkBatch
authorKunal Mehta <legoktm@member.fsf.org>
Mon, 6 Jun 2016 21:59:23 +0000 (14:59 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Mon, 6 Jun 2016 21:59:23 +0000 (14:59 -0700)
Usernames are stored with spaces instead of underscores, so this was
causing exceptions later on when dbkeys were expected to be provided to
TitleValue.

Let Title take care of normalization from spaces format to underscores
in Title::makeTitle(), and pass that object onto LinkBatch instead.

Bug: T137147
Change-Id: Ia3606d30de61173e4d5526a9d7a77bd4b1710a05

includes/actions/InfoAction.php

index b5f7ff2..7be2aa7 100644 (file)
@@ -478,16 +478,18 @@ class InfoAction extends FormlessAction {
                if ( $firstRev ) {
                        $firstRevUser = $firstRev->getUserText( Revision::FOR_THIS_USER );
                        if ( $firstRevUser !== '' ) {
-                               $batch->add( NS_USER, $firstRevUser );
-                               $batch->add( NS_USER_TALK, $firstRevUser );
+                               $firstRevUserTitle = Title::makeTitle( NS_USER, $firstRevUser );
+                               $batch->addObj( $firstRevUserTitle );
+                               $batch->addObj( $firstRevUserTitle->getTalkPage() );
                        }
                }
 
                if ( $lastRev ) {
                        $lastRevUser = $lastRev->getUserText( Revision::FOR_THIS_USER );
                        if ( $lastRevUser !== '' ) {
-                               $batch->add( NS_USER, $lastRevUser );
-                               $batch->add( NS_USER_TALK, $lastRevUser );
+                               $lastRevUserTitle = Title::makeTitle( NS_USER, $lastRevUser );
+                               $batch->addObj( $lastRevUserTitle );
+                               $batch->addObj( $lastRevUserTitle->getTalkPage() );
                        }
                }