API: Fix logic for list=recentchanges prop=userid
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 6 Mar 2014 03:57:24 +0000 (22:57 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 6 Mar 2014 03:59:04 +0000 (22:59 -0500)
When prop=userid is requested, we need the rc_user field; when prop=user
is requested, we need both rc_user and rc_user_text.

But for some reason when only prop=userid is requested the code is
requesting only rc_user_text and not rc_user. Fix that.

Bug: 62301
Change-Id: I86f1f35ebd18e45335cdf43ab3ba0a3e9b0e06b4

includes/api/ApiQueryRecentChanges.php

index 6ccc288..30dd741 100644 (file)
@@ -281,8 +281,8 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        /* Add fields to our query if they are specified as a needed parameter. */
                        $this->addFieldsIf( array( 'rc_this_oldid', 'rc_last_oldid' ), $this->fld_ids );
                        $this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
-                       $this->addFieldsIf( 'rc_user', $this->fld_user );
-                       $this->addFieldsIf( 'rc_user_text', $this->fld_user || $this->fld_userid );
+                       $this->addFieldsIf( 'rc_user', $this->fld_user || $this->fld_userid );
+                       $this->addFieldsIf( 'rc_user_text', $this->fld_user );
                        $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ), $this->fld_flags );
                        $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
                        $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );