* Adjust and correct codes for gitlab module.

This commit is contained in:
dingguodong
2021-10-29 10:06:50 +08:00
parent 07d6f3e27e
commit f3b6a38403
3 changed files with 8 additions and 10 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ $lang->gitlab->delete = 'Delete GitLab';
$lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?';
$lang->gitlab->gitlabAccount = 'GitLab Account';
$lang->gitlab->zentaoAccount = 'Zentao Account';
$lang->gitlab->serverFail = 'Conntect to GitLab server failed, please check the GitLab server.';
$lang->gitlab->serverFail = 'Connect to GitLab server failed, please check the GitLab server.';
$lang->gitlab->browseAction = 'GitLab List';
$lang->gitlab->deleteAction = 'Delete GitLab';
+7 -8
View File
@@ -386,7 +386,7 @@ class gitlabModel extends model
if(is_numeric($host)) $host = $this->getApiRoot($host);
if(strpos($host, 'http://') !== 0 and strpos($host, 'https://') !== 0) return false;
$url = sprintf($apiRoot, $api);
$url = sprintf($host, $api);
return json_decode(commonModel::http($url, $data, $options));
}
@@ -456,7 +456,7 @@ class gitlabModel extends model
*
* @param int $gitlabID
* @access public
* @return void
* @return array
*/
public function apiGetProjects($gitlabID)
{
@@ -673,6 +673,7 @@ class gitlabModel extends model
public function apiUpdateHook($gitlabID, $projectID, $hookID)
{
$apiRoot = $this->getApiRoot($gitlabID);
$url = sprintf($apiRoot, "/projects/{$projectID}/hooks/{$hookID}");
$postData = new stdclass;
$postData->enable_ssl_verification = "false";
@@ -681,8 +682,6 @@ class gitlabModel extends model
$postData->push_events = "true";
$postData->tag_push_events = "true";
$postData->note_events = "true";
$postData->url = $url;
$postData->token = $token;
$url = sprintf($apiRoot, "/projects/{$projectID}/hooks/{$hookID}");
return commonModel::http($url, $postData, $options = array(CURLOPT_CUSTOMREQUEST => 'PUT'));
@@ -1231,9 +1230,9 @@ class gitlabModel extends model
/**
* Create webhook for zentao.
*
* @param int $products
* @param int $gitlabID
* @param int $projectID
* @param array $products
* @param int $gitlabID
* @param int $projectID
* @access public
* @return bool
*/
@@ -1346,7 +1345,7 @@ class gitlabModel extends model
if($value) $issue->$field = $value;
}
if($isset($issue->assignee_id) and $issue->assignee_id == 'closed') unset($issue->assignee_id);
if(isset($issue->assignee_id) and $issue->assignee_id == 'closed') unset($issue->assignee_id);
/* issue->state is null when creating it, we should put status_event when updating it. */
if(isset($issue->state) and $issue->state == 'closed') $issue->state_event = 'close';
-1
View File
@@ -27,4 +27,3 @@
</div>
<?php include '../../common/view/footer.html.php';?>