X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryUsers.php;h=0171a37733dcb4cc30ff2d183fd201ef5387294f;hb=de64366f58f0af7a02a417833c8e0605e4140fab;hp=66d8db4987b18d441aac97b4cf4074640f5426e4;hpb=f2b01310d90060ba2ccba3e6d36b67e942bff978;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 66d8db4987..0171a37733 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -20,12 +20,15 @@ * @file */ +use MediaWiki\Block\DatabaseBlock; + /** * Query module to get information about a list of users * * @ingroup API */ class ApiQueryUsers extends ApiQueryBase { + use ApiQueryBlockInfoTrait; private $tokenFunctions, $prop; @@ -150,7 +153,7 @@ class ApiQueryUsers extends ApiQueryBase { $this->addWhereFld( 'user_id', $userids ); } - $this->showHiddenUsersAddBlockInfo( isset( $this->prop['blockinfo'] ) ); + $this->addBlockInfoToQuery( isset( $this->prop['blockinfo'] ) ); $data = []; $res = $this->select( __METHOD__ ); @@ -225,19 +228,14 @@ class ApiQueryUsers extends ApiQueryBase { } if ( isset( $this->prop['rights'] ) ) { - $data[$key]['rights'] = $user->getRights(); + $data[$key]['rights'] = $this->getPermissionManager() + ->getUserPermissions( $user ); } if ( $row->ipb_deleted ) { $data[$key]['hidden'] = true; } if ( isset( $this->prop['blockinfo'] ) && !is_null( $row->ipb_by_text ) ) { - $data[$key]['blockid'] = (int)$row->ipb_id; - $data[$key]['blockedby'] = $row->ipb_by_text; - $data[$key]['blockedbyid'] = (int)$row->ipb_by; - $data[$key]['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp ); - $data[$key]['blockreason'] = $commentStore->getComment( 'ipb_reason', $row ) - ->text; - $data[$key]['blockexpiry'] = $row->ipb_expiry; + $data[$key] += $this->getBlockDetails( DatabaseBlock::newFromRow( $row ) ); } if ( isset( $this->prop['emailable'] ) ) { @@ -331,8 +329,8 @@ class ApiQueryUsers extends ApiQueryBase { } } - $fit = $result->addValue( [ 'query', $this->getModuleName() ], - null, $data[$u] ); + // @phan-suppress-next-line PhanTypeArraySuspiciousNullable + $fit = $result->addValue( [ 'query', $this->getModuleName() ], null, $data[$u] ); if ( !$fit ) { if ( $useNames ) { $this->setContinueEnumParameter( 'users',