Yurik has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200087

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.

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


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather 
refs/changes/87/200087/1

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: newchange
Gerrit-Change-Id: Id256f214708f78a9d9b268b07f4246719e0e3925
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gather
Gerrit-Branch: master
Gerrit-Owner: Yurik <yu...@wikimedia.org>

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

Reply via email to