From da20e9dfa81aea57868b2ff2f73e8c20fff49cac Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Mon, 24 Jan 2022 08:36:47 +0000 Subject: [PATCH] * Fix bug #18920,18919,18918. --- module/gitlab/control.php | 2 -- module/gitlab/model.php | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 65b7f29a1a..87c90864b0 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -1036,8 +1036,6 @@ class gitlab extends control { $openID = $this->gitlab->getUserIDByZentaoAccount($gitlabID, $this->app->user->account); if(!$openID) return print(js::alert($this->lang->gitlab->mustBindUser) . js::locate($this->createLink('gitlab', 'browse'))); - - if(!$this->gitlab->checkUserAccess($gitlabID, $projectID, $project)) return print(js::alert($this->lang->gitlab->noAccess) . js::locate($this->createLink('gitlab', 'browse'))); } $this->session->set('gitlabTagList', $this->app->getURI(true)); diff --git a/module/gitlab/model.php b/module/gitlab/model.php index b1347f604e..777b5d2e5c 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -1489,10 +1489,19 @@ class gitlabModel extends model * @access public * @return object */ - public function apiGetBranches($gitlabID, $projectID) + public function apiGetBranches($gitlabID, $projectID, $pager = null) { $url = sprintf($this->getApiRoot($gitlabID), "/projects/{$projectID}/repository/branches"); - return json_decode(commonModel::http($url)); + $allResults = array(); + for($page = 1; true; $page++) + { + $results = json_decode(commonModel::http($url . "&&page={$page}&per_page=100")); + if(!is_array($results)) break; + if(!empty($results)) $allResults = array_merge($allResults, $results); + if(count($results)<100) break; + } + + return $allResults; } /**