Skip to content

Commit

Permalink
Merge branch 'main' into my
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdvdmt committed Jul 15, 2014
2 parents 9059a8e + 87d6dea commit cfe101f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Jira/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,9 @@ protected function automapFields($issue)
*/
public function setWatchers($issueKey, $watchers)
{
$result=[];
$result = array();
foreach($watchers as $w){
$result[]=$this->api(self::REQUEST_POST, sprintf("/rest/api/2/issue/%s/watchers", $issueKey), $w);
$result[] = $this->api(self::REQUEST_POST, sprintf("/rest/api/2/issue/%s/watchers", $issueKey), $w);
}
return $result;
}
Expand All @@ -519,17 +519,25 @@ public function setWatchers($issueKey, $watchers)
*
* @param $issueKey
* @return mixed
*
* @TODO: should have parameters? (e.g comment)
*/
public function closeIssue($issueKey)
{
$result=[];
$result = array();
// get available transitions
$transitions=$this->getTransitions($issueKey,[])->getResult()['transitions'];
$tmp_transitions = $this->getTransitions($issueKey, array());
$tmp_transitions_result = $tmp_transitions->getResult();
$transitions = $tmp_transitions_result['transitions'];

// search id for closing ticket
foreach ($transitions as $v) {
// Close ticket if required id was found
if($v['name']=="Close Issue"){
$result=$this->transition($issueKey,['transition'=>['id'=>$v['id']]]);
if($v['name'] == "Close Issue"){
$result = $this->transition($issueKey, array(
'transition'=> array(
'id'=>$v['id']
)));
break;
}
}
Expand Down

0 comments on commit cfe101f

Please sign in to comment.