X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiUnblock.php;h=ace41a4e364c16f5714390d604d9f2761b12da49;hb=76d62d7b204b48a0794032d2266ed64455058d13;hp=f6c24b7627244b72e6253218a0c17c8a40ac792c;hpb=f8ab4e5ffee1cfb53da38d3dffcd37ffe4e2abbc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index f6c24b7627..ace41a4e36 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -58,15 +58,24 @@ class ApiUnblock extends ApiBase { $msg['info'], $msg['code'], 0, - array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ) + [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ] ); } } - $data = array( + // Check if user can add tags + if ( !is_null( $params['tags'] ) ) { + $ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user ); + if ( !$ableToTag->isOK() ) { + $this->dieStatus( $ableToTag ); + } + } + + $data = [ 'Target' => is_null( $params['id'] ) ? $params['user'] : "#{$params['id']}", - 'Reason' => $params['reason'] - ); + 'Reason' => $params['reason'], + 'Tags' => $params['tags'] + ]; $block = Block::newFromTarget( $data['Target'] ); $retval = SpecialUnblock::processUnblock( $data, $this->getContext() ); if ( $retval !== true ) { @@ -90,13 +99,17 @@ class ApiUnblock extends ApiBase { } public function getAllowedParams() { - return array( - 'id' => array( + return [ + 'id' => [ ApiBase::PARAM_TYPE => 'integer', - ), + ], 'user' => null, 'reason' => '', - ); + 'tags' => [ + ApiBase::PARAM_TYPE => 'tags', + ApiBase::PARAM_ISMULTI => true, + ], + ]; } public function needsToken() { @@ -104,12 +117,12 @@ class ApiUnblock extends ApiBase { } protected function getExamplesMessages() { - return array( + return [ 'action=unblock&id=105' => 'apihelp-unblock-example-id', 'action=unblock&user=Bob&reason=Sorry%20Bob' => 'apihelp-unblock-example-user', - ); + ]; } public function getHelpUrls() {