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

Change subject: Always select ipb_deleted on list=[all]users
......................................................................


Always select ipb_deleted on list=[all]users

When a user with the hideuser permission is using list=[all]users, a
- Notice: Undefined property: stdClass::$ipb_deleted in
\includes\api\ApiQueryUsers.php on line 172
- Notice: Undefined property: stdClass::$ipb_deleted in
\includes\api\ApiQueryAllUsers.php on line 238
can be raised, because the join on the ipblocks table was not done for
the user.

Change-Id: I25ead34b7905e99c249cb05c9d4940195c8b6263
---
M includes/api/ApiQueryBase.php
1 file changed, 11 insertions(+), 15 deletions(-)

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



diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php
index cfc2244..fcd3180 100644
--- a/includes/api/ApiQueryBase.php
+++ b/includes/api/ApiQueryBase.php
@@ -547,24 +547,20 @@
         * @return void
         */
        public function showHiddenUsersAddBlockInfo( $showBlockInfo ) {
-               $userCanViewHiddenUsers = $this->getUser()->isAllowed( 
'hideuser' );
+               $this->addTables( 'ipblocks' );
+               $this->addJoinConds( array(
+                       'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ),
+               ) );
 
-               if ( $showBlockInfo || !$userCanViewHiddenUsers ) {
-                       $this->addTables( 'ipblocks' );
-                       $this->addJoinConds( array(
-                               'ipblocks' => array( 'LEFT JOIN', 
'ipb_user=user_id' ),
-                       ) );
+               $this->addFields( 'ipb_deleted' );
 
-                       $this->addFields( 'ipb_deleted' );
+               if ( $showBlockInfo ) {
+                       $this->addFields( array( 'ipb_id', 'ipb_by', 
'ipb_by_text', 'ipb_reason', 'ipb_expiry' ) );
+               }
 
-                       if ( $showBlockInfo ) {
-                               $this->addFields( array( 'ipb_id', 'ipb_by', 
'ipb_by_text', 'ipb_reason', 'ipb_expiry' ) );
-                       }
-
-                       // Don't show hidden names
-                       if ( !$userCanViewHiddenUsers ) {
-                               $this->addWhere( 'ipb_deleted = 0 OR 
ipb_deleted IS NULL' );
-                       }
+               // Don't show hidden names
+               if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
+                       $this->addWhere( 'ipb_deleted = 0 OR ipb_deleted IS 
NULL' );
                }
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I25ead34b7905e99c249cb05c9d4940195c8b6263
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to