* Modify gitlab to git service in repo module.
This commit is contained in:
@@ -576,7 +576,6 @@ class gitea
|
||||
$log->time = date('Y-m-d H:i:s', strtotime($commit->commit->committer->date));
|
||||
|
||||
$commits[$commit->sha] = $log;
|
||||
$files[$commit->sha] = $this->getFilesByCommit($log->revision);
|
||||
}
|
||||
|
||||
return array('commits' => $commits, 'files' => $files);
|
||||
|
||||
@@ -131,8 +131,8 @@ class gitModel extends model
|
||||
$gitlabAccountPairs = array();
|
||||
if($repo->SCM == 'Gitlab')
|
||||
{
|
||||
$gitlabUserList = $this->loadModel('gitlab')->apiGetUsers($repo->gitlab);
|
||||
$acountIDPairs = $this->gitlab->getUserIdAccountPairs($repo->gitlab);
|
||||
$gitlabUserList = $this->loadModel('gitlab')->apiGetUsers($repo->gitService);
|
||||
$acountIDPairs = $this->gitlab->getUserIdAccountPairs($repo->gitService);
|
||||
foreach($gitlabUserList as $gitlabUser) $gitlabAccountPairs[$gitlabUser->realname] = zget($acountIDPairs, $gitlabUser->id, '');
|
||||
}
|
||||
|
||||
|
||||
@@ -1203,7 +1203,7 @@ class gitlabModel extends model
|
||||
/* Return an empty array if where is one existing webhook. */
|
||||
if($this->isWebhookExists($repo, $hook->url)) return array();
|
||||
|
||||
$result = $this->apiCreateHook($repo->gitlab, $repo->project, $hook);
|
||||
$result = $this->apiCreateHook($repo->gitService, $repo->project, $hook);
|
||||
|
||||
if(!empty($result->id)) return true;
|
||||
return false;
|
||||
@@ -1218,7 +1218,7 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function isWebhookExists($repo, $url = '')
|
||||
{
|
||||
$hookList = $this->apiGetHooks($repo->gitlab, $repo->project);
|
||||
$hookList = $this->apiGetHooks($repo->gitService, $repo->project);
|
||||
foreach($hookList as $hook)
|
||||
{
|
||||
if($hook->url == $url) return true;
|
||||
|
||||
@@ -111,7 +111,7 @@ class job extends control
|
||||
$repoTypes[$repo->id] = $repo->SCM;
|
||||
if(strtolower($repo->SCM) == 'gitlab')
|
||||
{
|
||||
if(isset($repo->gitlab)) $gitlab = $this->loadModel('gitlab')->getByID($repo->gitlab);
|
||||
if(isset($repo->gitService)) $gitlab = $this->loadModel('gitlab')->getByID($repo->gitService);
|
||||
if(!empty($gitlab)) $tokenUser = $this->gitlab->apiGetCurrentUser($gitlab->url, $gitlab->token);
|
||||
if(!isset($tokenUser->is_admin) or !$tokenUser->is_admin) continue;
|
||||
$gitlabRepos[$repo->id] = $repo->name;
|
||||
@@ -177,7 +177,7 @@ class job extends control
|
||||
$repo = $this->loadModel('repo')->getRepoByID($job->repo);
|
||||
$this->view->repo = $this->loadModel('repo')->getRepoByID($job->repo);
|
||||
|
||||
if($repo->SCM == 'Gitlab') $this->view->refList = $this->loadModel('gitlab')->getReferenceOptions($repo->gitlab, $repo->project);
|
||||
if($repo->SCM == 'Gitlab') $this->view->refList = $this->loadModel('gitlab')->getReferenceOptions($repo->gitService, $repo->project);
|
||||
|
||||
$repoList = $this->repo->getList($this->projectID);
|
||||
$repoPairs = array(0 => '', $repo->id => $repo->name);
|
||||
@@ -380,7 +380,7 @@ class job extends control
|
||||
public function ajaxGetRefList($repoID)
|
||||
{
|
||||
$repo = $this->loadModel('repo')->getRepoByID($repoID);
|
||||
if($repo->SCM == 'Gitlab') $refList = $this->loadModel('gitlab')->getReferenceOptions($repo->gitlab, $repo->project);
|
||||
if($repo->SCM == 'Gitlab') $refList = $this->loadModel('gitlab')->getReferenceOptions($repo->gitService, $repo->project);
|
||||
if($repo->SCM != 'Gitlab') $refList = $this->repo->getBranches($repo, true);
|
||||
$this->send(array('result' => 'success', 'refList' => $refList));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user