r108911 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108910‎ | r108911 | r108912 >
Date:15:54, 14 January 2012
Author:reedy
Status:ok
Tags:miscextensions 
Comment:
Bug 33713 - Show "previous" revisions in addition to follow-ups

Add followedup in the api

Fix < to > for r108907

Also fix bug noticed "ApiResult::setContent( $refItem, $row->cr_message );" should be using $rev->cr_message, as it's adding the commit summary for that rev, not for the parent rev
Modified paths:
  • /trunk/extensions/CodeReview/api/ApiQueryCodeRevisions.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -954,7 +954,7 @@
955955 __METHOD__
956956 );
957957 foreach( $res as $row ) {
958 - if ( $this->id < intval( $row->cr_id ) ) {
 958+ if ( $this->id > intval( $row->cr_id ) ) {
959959 $refs[] = $row;
960960 }
961961 }
Index: trunk/extensions/CodeReview/api/ApiQueryCodeRevisions.php
@@ -137,24 +137,39 @@
138138 if ( $rev === null ) {
139139 $rev = CodeRevision::newFromRow( $repo, $row );
140140 }
141 - $item['followups'] = array();
142 - foreach ( $rev->getFollowupRevisions() as $ref ) {
143 - $refItem = array(
144 - 'revid' => $ref->cr_id,
145 - 'status' => $ref->cr_status,
146 - 'timestamp' => wfTimestamp( TS_ISO_8601, $ref->cr_timestamp ),
147 - 'author' => $ref->cr_author ,
148 - );
149 - ApiResult::setContent( $refItem, $row->cr_message );
 141+ $item['followsup'] = $this->addReferenced( $rev );
 142+ $result->setIndexedTagName( $item['followsup'], 'followsup' );
 143+ }
150144
151 - $item['followups'][] = $refItem;
 145+ if ( isset( $this->props['followedup'] ) ) {
 146+ if ( $rev === null ) {
 147+ $rev = CodeRevision::newFromRow( $repo, $row );
152148 }
153 -
154 - $result->setIndexedTagName( $item['followups'], 'followups' );
 149+ $item['followedup'] = $this->addReferenced( $rev );
 150+ $result->setIndexedTagName( $item['followedup'], 'followedup' );
155151 }
156152 return $item;
157153 }
158154
 155+ /**
 156+ * @param $rev CodeRevision
 157+ */
 158+ protected function addReferenced( $rev ) {
 159+ $items = array();
 160+ foreach ( $rev->getFollowedUpRevisions() as $ref ) {
 161+ $refItem = array(
 162+ 'revid' => $ref->cr_id,
 163+ 'status' => $ref->cr_status,
 164+ 'timestamp' => wfTimestamp( TS_ISO_8601, $ref->cr_timestamp ),
 165+ 'author' => $ref->cr_author ,
 166+ );
 167+ ApiResult::setContent( $refItem, $ref->cr_message );
 168+
 169+ $items[] = $refItem;
 170+ }
 171+ return $items;
 172+ }
 173+
159174 public function getAllowedParams() {
160175 return array(
161176 'repo' => array(
@@ -190,6 +205,7 @@
191206 'tags',
192207 'timestamp',
193208 'followups',
 209+ 'followedup',
194210 ),
195211 ),
196212 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r108912Bug 33713 - Show "previous" revisions in addition to follow-ups...reedy15:59, 14 January 2012
r108920Few more bits of refactoring for bug 33713reedy17:02, 14 January 2012
r108922And that should be the rest of bug 33713reedy17:13, 14 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108907Bit of prep work for bug 33713...reedy15:25, 14 January 2012

Status & tagging log