Index: trunk/extensions/CodeReview/backend/CodeRevision.php |
— | — | @@ -954,7 +954,7 @@ |
955 | 955 | __METHOD__ |
956 | 956 | ); |
957 | 957 | foreach( $res as $row ) { |
958 | | - if ( $this->id < intval( $row->cr_id ) ) { |
| 958 | + if ( $this->id > intval( $row->cr_id ) ) { |
959 | 959 | $refs[] = $row; |
960 | 960 | } |
961 | 961 | } |
Index: trunk/extensions/CodeReview/api/ApiQueryCodeRevisions.php |
— | — | @@ -137,24 +137,39 @@ |
138 | 138 | if ( $rev === null ) { |
139 | 139 | $rev = CodeRevision::newFromRow( $repo, $row ); |
140 | 140 | } |
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 | + } |
150 | 144 | |
151 | | - $item['followups'][] = $refItem; |
| 145 | + if ( isset( $this->props['followedup'] ) ) { |
| 146 | + if ( $rev === null ) { |
| 147 | + $rev = CodeRevision::newFromRow( $repo, $row ); |
152 | 148 | } |
153 | | - |
154 | | - $result->setIndexedTagName( $item['followups'], 'followups' ); |
| 149 | + $item['followedup'] = $this->addReferenced( $rev ); |
| 150 | + $result->setIndexedTagName( $item['followedup'], 'followedup' ); |
155 | 151 | } |
156 | 152 | return $item; |
157 | 153 | } |
158 | 154 | |
| 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 | + |
159 | 174 | public function getAllowedParams() { |
160 | 175 | return array( |
161 | 176 | 'repo' => array( |
— | — | @@ -190,6 +205,7 @@ |
191 | 206 | 'tags', |
192 | 207 | 'timestamp', |
193 | 208 | 'followups', |
| 209 | + 'followedup', |
194 | 210 | ), |
195 | 211 | ), |
196 | 212 | ); |