From 8ebcebebdef423b8d405584621067056a253f97b Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 1 Nov 2023 11:01:04 +0800 Subject: [PATCH] * Ajust third menu build rule for execution. --- module/execution/model.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 9b0961acf4..81c8c38ca1 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -166,20 +166,23 @@ class executionModel extends model $repoPairs = $this->loadModel('repo')->getRepoPairs('execution', $executionID); $showMR = false; - foreach($repoPairs as $repoName) + if(common::hasPriv('mr', 'browse')) { - preg_match('/^\[(\w+)\]/', $repoName, $matches); - if(isset($matches[1]) && in_array($matches[1], $this->config->repo->gitServiceList)) $showMR = true; - } - if(!$showMR && $this->config->edition == 'open') - { - unset($this->lang->execution->menu->devops['subMenu']->mr); - if($this->config->edition == 'open' || !common::hasPriv('repo', 'review')) + foreach($repoPairs as $repoName) { - unset($this->lang->execution->menu->devops['subMenu']); - $this->lang->execution->menu->devops['link'] = str_replace($this->lang->devops->common, $this->lang->repo->common, $this->lang->execution->menu->devops['link']); + preg_match('/^\[(\w+)\]/', $repoName, $matches); + if(isset($matches[1]) && in_array($matches[1], $this->config->repo->gitServiceList)) $showMR = true; } } + if(!$showMR) unset($this->lang->execution->menu->devops['subMenu']->mr); + if(!common::hasPriv('repo', 'review')) unset($this->lang->execution->menu->devops['subMenu']->review); + + + if(empty($this->lang->execution->menu->devops['subMenu']->mr) && empty($this->lang->execution->menu->devops['subMenu']->review)) + { + unset($this->lang->execution->menu->devops['subMenu']); + $this->lang->execution->menu->devops['link'] = str_replace($this->lang->devops->common, $this->lang->repo->common, $this->lang->execution->menu->devops['link']); + } } if($this->cookie->executionMode == 'noclosed' and $execution and ($execution->status == 'done' or $execution->status == 'closed'))