jenkins-bot has submitted this change and it was merged.

Change subject: Fixing isBlocked() on ApiEditList
......................................................................


Fixing isBlocked() on ApiEditList

* There is a special function to test all
  permission, use it, don't put such checks
  all over the code.
* Establishing a connection to a very busy
  master server only to bail out due to permission
  issue seems extremely inefficient.

Fixing Change-Id: I4062be5cd307eca41e49fda4c4d7672510f2e94b

Bug: T94105
Change-Id: Id256f214708f78a9d9b268b07f4246719e0e3925
---
M includes/api/ApiEditList.php
1 file changed, 2 insertions(+), 3 deletions(-)

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



diff --git a/includes/api/ApiEditList.php b/includes/api/ApiEditList.php
index 0f7f17b..bff2e16 100644
--- a/includes/api/ApiEditList.php
+++ b/includes/api/ApiEditList.php
@@ -75,9 +75,6 @@
                $isWatchlist = $listId === 0;
 
                $dbw = wfGetDB( DB_MASTER, 'api' );
-               if ( $user->isBlocked() ) {
-                       $this->dieUsage( 'You are blocked from editing your 
collection', 'blockeduser' );
-               }
 
                if ( $isNew || $isWatchlist ) {
                        // ACTION: create a new list
@@ -172,6 +169,8 @@
                        $this->dieUsage( 'You must be logged-in to edit a 
list', 'notloggedin' );
                } elseif ( !$user->isAllowed( 'editmywatchlist' ) ) {
                        $this->dieUsage( 'You don\'t have permission to edit 
your list', 'permissiondenied' );
+               } elseif ( $user->isBlocked() ) {
+                       $this->dieUsage( 'You are blocked from editing your 
list', 'blocked' );
                } elseif ( $label === '' ) {
                        $this->dieUsage( 'If given, label must not be empty', 
'badlabel' );
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id256f214708f78a9d9b268b07f4246719e0e3925
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Robmoen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to