jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/331212 )

Change subject: ApiReview: Make generic error conditionals actually reachable
......................................................................


ApiReview: Make generic error conditionals actually reachable

These errors can be generated when approving and when unapproving, so
it didn't make sense to have them in an else block at the bottom where
they couldn't be reached.

Bug: T56817
Change-Id: I889011deef5686be1fd8bc132a49b75162ed1400
---
M api/actions/ApiReview.php
1 file changed, 13 insertions(+), 15 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/api/actions/ApiReview.php b/api/actions/ApiReview.php
index 6f3aa71..ad3b35c 100644
--- a/api/actions/ApiReview.php
+++ b/api/actions/ApiReview.php
@@ -113,6 +113,19 @@
                if ( $status === true ) {
                        $this->getResult()->addValue(
                                null, $this->getModuleName(), array( 'result' 
=> 'Success' ) );
+               # Generic failures
+               } elseif ( $status === 'review_page_notexists' ) {
+                       if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+                               $this->dieWithError( 
'apierror-flaggedrevs-pagedoesnotexist', 'notarget' );
+                       } else {
+                               $this->dieUsage( "Provided page does not 
exist.", 'notarget' );
+                       }
+               } elseif ( $status === 'review_page_unreviewable' ) {
+                       if ( is_callable( array( $this, 'dieWithError' ) ) ) {
+                               $this->dieWithError( 
'apierror-flaggedrevs-notreviewable', 'notreviewable' );
+                       } else {
+                               $this->dieUsage( "Provided page is not 
reviewable.", 'notreviewable' );
+                       }
                # Approve-specific failures
                } elseif ( $form->getAction() === 'approve' ) {
                        if ( $status === 'review_denied' ) {
@@ -177,21 +190,6 @@
                                        $this->dieWithError( array( 
'apierror-unknownerror-nocode' ), 'unknownerror' );
                                } else {
                                        $this->dieUsageMsg( array( 
'unknownerror', '' ) );
-                               }
-                       }
-               # Generic failures
-               } else {
-                       if ( $status === 'review_page_unreviewable' ) {
-                               if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
-                                       $this->dieWithError( 
'apierror-flaggedrevs-notreviewable', 'notreviewable' );
-                               } else {
-                                       $this->dieUsage( "Provided page is not 
reviewable.", 'notreviewable' );
-                               }
-                       } elseif ( $status === 'review_page_notexists' ) {
-                               if ( is_callable( array( $this, 'dieWithError' 
) ) ) {
-                                       $this->dieWithError( 
'apierror-flaggedrevs-pagedoesnotexist', 'notarget' );
-                               } else {
-                                       $this->dieUsage( "Provided page does 
not exist.", 'notarget' );
                                }
                        }
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/331212
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I889011deef5686be1fd8bc132a49b75162ed1400
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FlaggedRevs
Gerrit-Branch: master
Gerrit-Owner: TTO <at.li...@live.com.au>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Catrope <r...@wikimedia.org>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to