From aee9970d4a0a0dc3c0fedabcb1488eeab41af515 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Fri, 22 Jul 2022 09:17:57 +0800 Subject: [PATCH] * Fix bug #25580. --- module/mr/control.php | 14 +++++++++++--- module/mr/lang/de.php | 2 ++ module/mr/lang/en.php | 2 ++ module/mr/lang/fr.php | 2 ++ module/mr/lang/vi.php | 2 ++ module/mr/lang/zh-cn.php | 2 ++ module/mr/view/create.html.php | 2 +- module/mr/view/linkstory.html.php | 2 +- 8 files changed, 23 insertions(+), 5 deletions(-) diff --git a/module/mr/control.php b/module/mr/control.php index 5333cc6682..8be2015221 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -106,11 +106,19 @@ class mr extends control $repoID = $this->loadModel('repo')->saveState(0); $repo = $this->repo->getRepoByID($repoID); + + $this->loadModel('gitea'); + if($repo->SCM == 'Gitea') + { + $project = $this->gitea->apiGetSingleProject($repo->gitService, $repo->project); + if(empty($project) or !$project->allow_merge_commits) $repo = array(); + } + $hosts = $this->loadModel('pipeline')->getList(array('gitea', 'gitlab')); if(!$this->app->user->admin) { $gitlabUsers = $this->loadModel('gitlab')->getGitLabListByAccount(); - $giteaUsers = $this->loadModel('gitea')->getGiteaListByAccount(); + $giteaUsers = $this->gitea->getGiteaListByAccount(); foreach($hosts as $hostID => $host) { if($host->type == 'gitLab' and isset($gitlabUsers[$hostID])) continue; @@ -575,7 +583,7 @@ class mr extends control $this->app->loadLang('productplan'); $product = $this->loadModel('product')->getById($productID); - $modules = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'story'); + $modules = $this->loadModel('tree')->getOptionMenu($productID, 'story'); /* Load pager. */ $this->app->loadClass('pager', $static = true); @@ -619,7 +627,7 @@ class mr extends control } else { - $allStories = $this->story->getProductStories($productID, 0, $moduleID = '0', $status = 'draft,active,changed', 'story', 'id_desc', $hasParent = false, array_keys($linkedStories), $pager); + $allStories = $this->story->getProductStories($productID, 0, '0', 'draft,active,changed', 'story', 'id_desc', false, array_keys($linkedStories), $pager); } $this->view->modules = $modules; diff --git a/module/mr/lang/de.php b/module/mr/lang/de.php index f0046ebdd7..dde731f59d 100644 --- a/module/mr/lang/de.php +++ b/module/mr/lang/de.php @@ -119,6 +119,7 @@ $lang->mr->apiErrorMap[3] = "401 Unauthorized"; $lang->mr->apiErrorMap[4] = "403 Forbidden"; $lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/"; $lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base"; +$lang->mr->apiErrorMap[7] = "/(user doesn't have access to repo).*/"; $lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch'; $lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u'; @@ -126,6 +127,7 @@ $lang->mr->errorLang[3] = "Unauthorized"; $lang->mr->errorLang[4] = 'Permission denied'; $lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch'; $lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch'; +$lang->mr->errorLang[7] = "user doesn't have access to repo"; $lang->mr->from = "from"; $lang->mr->to = "to"; diff --git a/module/mr/lang/en.php b/module/mr/lang/en.php index f0046ebdd7..dde731f59d 100644 --- a/module/mr/lang/en.php +++ b/module/mr/lang/en.php @@ -119,6 +119,7 @@ $lang->mr->apiErrorMap[3] = "401 Unauthorized"; $lang->mr->apiErrorMap[4] = "403 Forbidden"; $lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/"; $lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base"; +$lang->mr->apiErrorMap[7] = "/(user doesn't have access to repo).*/"; $lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch'; $lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u'; @@ -126,6 +127,7 @@ $lang->mr->errorLang[3] = "Unauthorized"; $lang->mr->errorLang[4] = 'Permission denied'; $lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch'; $lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch'; +$lang->mr->errorLang[7] = "user doesn't have access to repo"; $lang->mr->from = "from"; $lang->mr->to = "to"; diff --git a/module/mr/lang/fr.php b/module/mr/lang/fr.php index f0046ebdd7..dde731f59d 100644 --- a/module/mr/lang/fr.php +++ b/module/mr/lang/fr.php @@ -119,6 +119,7 @@ $lang->mr->apiErrorMap[3] = "401 Unauthorized"; $lang->mr->apiErrorMap[4] = "403 Forbidden"; $lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/"; $lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base"; +$lang->mr->apiErrorMap[7] = "/(user doesn't have access to repo).*/"; $lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch'; $lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u'; @@ -126,6 +127,7 @@ $lang->mr->errorLang[3] = "Unauthorized"; $lang->mr->errorLang[4] = 'Permission denied'; $lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch'; $lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch'; +$lang->mr->errorLang[7] = "user doesn't have access to repo"; $lang->mr->from = "from"; $lang->mr->to = "to"; diff --git a/module/mr/lang/vi.php b/module/mr/lang/vi.php index f0046ebdd7..dde731f59d 100644 --- a/module/mr/lang/vi.php +++ b/module/mr/lang/vi.php @@ -119,6 +119,7 @@ $lang->mr->apiErrorMap[3] = "401 Unauthorized"; $lang->mr->apiErrorMap[4] = "403 Forbidden"; $lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/"; $lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base"; +$lang->mr->apiErrorMap[7] = "/(user doesn't have access to repo).*/"; $lang->mr->errorLang[1] = 'The source project branch cannot be the same as the target project branch'; $lang->mr->errorLang[2] = 'Another open merge request already exists for this source branch: ID%u'; @@ -126,6 +127,7 @@ $lang->mr->errorLang[3] = "Unauthorized"; $lang->mr->errorLang[4] = 'Permission denied'; $lang->mr->errorLang[5] = 'Another open merge request already exists for this source branch'; $lang->mr->errorLang[6] = 'The source project branch cannot be the same as the target project branch'; +$lang->mr->errorLang[7] = "user doesn't have access to repo"; $lang->mr->from = "from"; $lang->mr->to = "to"; diff --git a/module/mr/lang/zh-cn.php b/module/mr/lang/zh-cn.php index cb129a2da4..4dbcbb1fca 100644 --- a/module/mr/lang/zh-cn.php +++ b/module/mr/lang/zh-cn.php @@ -119,6 +119,7 @@ $lang->mr->apiErrorMap[3] = "401 Unauthorized"; $lang->mr->apiErrorMap[4] = "403 Forbidden"; $lang->mr->apiErrorMap[5] = "/(pull request already exists for these targets).*/"; $lang->mr->apiErrorMap[6] = "Invalid PullRequest: There are no changes between the head and the base"; +$lang->mr->apiErrorMap[7] = "/(user doesn't have access to repo).*/"; $lang->mr->errorLang[1] = '源项目分支与目标项目分支不能相同'; $lang->mr->errorLang[2] = '存在另外一个同样的合并请求在源项目分支中: ID%u'; @@ -126,6 +127,7 @@ $lang->mr->errorLang[3] = '权限不足'; $lang->mr->errorLang[4] = '权限不足'; $lang->mr->errorLang[5] = '存在另外一个同样的合并请求在源项目分支中'; $lang->mr->errorLang[6] = '源项目分支与目标项目分支不能相同'; +$lang->mr->errorLang[7] = '您无权合并改版本库'; $lang->mr->from = "从"; $lang->mr->to = "合并到"; diff --git a/module/mr/view/create.html.php b/module/mr/view/create.html.php index ee38b35821..d963aedb09 100644 --- a/module/mr/view/create.html.php +++ b/module/mr/view/create.html.php @@ -24,7 +24,7 @@ - + diff --git a/module/mr/view/linkstory.html.php b/module/mr/view/linkstory.html.php index 9e6834fa73..9b464d0574 100644 --- a/module/mr/view/linkstory.html.php +++ b/module/mr/view/linkstory.html.php @@ -47,7 +47,7 @@ - +
mr->server;?>gitService, "class='form-control chosen'");?>
mr->sourceProject;?> pri;?>' title='story->priList, $story->pri, $story->pri)?>'>story->priList, $story->pri, $story->pri)?> planTitle;?>module];?>' class='text-left'>module, '/');?> parent > 0) echo "story->children}>{$lang->story->childrenAB}";