* Ajust third menu build rule for execution.

This commit is contained in:
caoyanyi
2023-11-01 11:01:07 +08:00
parent d263cb5309
commit 8ebcebebde
+13 -10
View File
@@ -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'))