r76493 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76492‎ | r76493 | r76494 >
Date:03:18, 11 November 2010
Author:aaron
Status:deferred
Tags:
Comment:
* Removed "all tags 0" exception, we now use "unaccept" instead
* Simplified review_too_low check code
Modified paths:
  • /trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php
@@ -29,7 +29,6 @@
3030 protected $comment = '';
3131 protected $dims = array();
3232
33 - protected $unapprovedTags = 0;
3433 protected $oflags = array();
3534 protected $inputLock = 0; # Disallow bad submissions
3635
@@ -203,35 +202,25 @@
204203 protected function checkSettings() {
205204 $status = $this->checkTarget();
206205 if ( $status !== true ) {
207 - return $status; // bad target
 206+ return $status; // bad page target
 207+ } elseif ( !$this->oldid ) {
 208+ return 'review_no_oldid'; // bad revision target
208209 }
209 - if ( !$this->oldid ) {
210 - return 'review_no_oldid';
211 - }
212 - # Check that this is an approval or de-approval
 210+ # Check that an action is specified (approve, reject, de-approve)
213211 if ( $this->getAction() === null ) {
214212 return 'review_param_missing'; // user didn't say
215213 }
216214 # Fill in implicit tag data for binary flag case
217215 $iDims = $this->implicitDims();
218216 if ( $iDims ) {
219 - $this->dims = $iDims;
220 - } else {
221 - foreach ( FlaggedRevs::getTags() as $tag ) {
222 - if ( $this->dims[$tag] === 0 ) {
223 - $this->unapprovedTags++;
224 - }
225 - }
 217+ $this->dims = $iDims; // binary flag case
226218 }
227 - # We must at least rate each category as 1, the minimum
228 - # Exception: we can rate ALL as unapproved to depreciate a revision
229 - if ( $this->unapprovedTags
230 - && $this->unapprovedTags < count( FlaggedRevs::getTags() ) )
231 - {
232 - return 'review_too_low';
233 - }
234 - # Special token to discourage fiddling with template/files...
235219 if ( $this->getAction() === 'approve' ) {
 220+ # We must at least rate each category as 1, the minimum
 221+ if ( in_array( 0, $this->dims, true ) ) {
 222+ return 'review_too_low';
 223+ }
 224+ # Special token to discourage fiddling with template/files...
236225 $k = self::validationKey(
237226 $this->templateParams, $this->imageParams, $this->fileVersion, $this->oldid );
238227 if ( $this->validatedParams !== $k ) {

Status & tagging log