Add parentid to output of list=usercontribs
authorBrian Wolff <bawolff+wn@gmail.com>
Tue, 23 Apr 2013 21:01:32 +0000 (18:01 -0300)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 24 Apr 2013 14:33:43 +0000 (14:33 +0000)
This makes it consistent with prop=revisions. Was requested on
irc by Betacommand.

Change-Id: Idfbee9b4f089738ab70825c11945faf8dd3da66d

RELEASE-NOTES-1.22
includes/api/ApiQueryUserContributions.php

index ade430f..eda1e7c 100644 (file)
@@ -72,6 +72,7 @@ production.
   longer be), and will no longer choke on booleans.
 * action=opensearch no longer silently ignores the format parameter.
 * action=opensearch now supports format=jsonfm.
+* list=usercontribs&ucprop=ids will now include the parent revision id.
 
 === Languages updated in 1.22===
 
index 6d20d66..df278c2 100644 (file)
@@ -255,7 +255,7 @@ class ApiQueryContributions extends ApiQueryBase {
                $this->addFieldsIf( 'rev_comment', $this->fld_comment || $this->fld_parsedcomment );
                $this->addFieldsIf( 'rev_len', $this->fld_size || $this->fld_sizediff );
                $this->addFieldsIf( 'rev_minor_edit', $this->fld_flags );
-               $this->addFieldsIf( 'rev_parent_id', $this->fld_flags || $this->fld_sizediff );
+               $this->addFieldsIf( 'rev_parent_id', $this->fld_flags || $this->fld_sizediff || $this->fld_ids );
                $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
 
                if ( $this->fld_tags ) {
@@ -297,6 +297,10 @@ class ApiQueryContributions extends ApiQueryBase {
                        $vals['pageid'] = intval( $row->rev_page );
                        $vals['revid'] = intval( $row->rev_id );
                        // $vals['textid'] = intval( $row->rev_text_id ); // todo: Should this field be exposed?
+
+                       if ( !is_null( $row->rev_parent_id ) ) {
+                               $vals['parentid'] = intval( $row->rev_parent_id );
+                       }
                }
 
                $title = Title::makeTitle( $row->page_namespace, $row->page_title );
@@ -474,7 +478,11 @@ class ApiQueryContributions extends ApiQueryBase {
                        ),
                        'ids' => array(
                                'pageid' => 'integer',
-                               'revid' => 'integer'
+                               'revid' => 'integer',
+                               'parentid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               )
                        ),
                        'title' => array(
                                'ns' => 'namespace',