This commit is contained in:
Guan Xiying
2021-06-25 14:56:12 +08:00
+26 -1
View File
@@ -327,6 +327,31 @@ class gitlabModel extends model
return json_decode($response);
}
/**
* Delete a Label by labelName.
*
* @param int $gitlabID
* @param int $projectID
* @param string $labelName
* @access public
* @return void
*/
public function apiDeleteLabel($gitlabID, $projectID, $labelName)
{
$labels = $this->apiGetLabels($gitlabID, $projectID);
foreach($labels as $label)
{
if($label->name == $labelName) $labelID = $label->id;
}
if(empty($labelID)) return false;
$apiRoot = $this->getApiRoot($gitlabID);
$url = sprintf($apiRoot, "/projects/{$projectID}/labels/{$labelID}");
return json_decode(commonModel::http($url, $options = array(CURLOPT_CUSTOMREQUEST => 'DELETE')));
}
/**
* Create zentao object label for gitlab project.
*
@@ -835,7 +860,7 @@ class gitlabModel extends model
*/
public function issueToZentaoObject($issue, $gitlabID)
{
if(!isset($this->config->gitlab->maps->{$issue->objectType}) return null;
if(!isset($this->config->gitlab->maps->{$issue->objectType})) return null;
$maps = $this->config->gitlab->maps->{$issue->objectType};
$gitlabUsers = $this->getUserAccountIdPairs($gitlabID);