diff --git a/module/mr/control.php b/module/mr/control.php index 77f7dac440..ce34115c78 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -247,6 +247,13 @@ class mr extends control $sourceBranch = $this->gitlab->apiGetSingleBranch($MR->gitlabID, $MR->sourceProject, $MR->sourceBranch); $targetBranch = $this->gitlab->apiGetSingleBranch($MR->gitlabID, $MR->targetProject, $MR->targetBranch); + $projectOwner = true; + if(isset($MR->gitlabID) and !$this->app->user->admin) + { + $openID = $this->gitlab->getUserIDByZentaoAccount($MR->gitlabID, $this->app->user->account); + if(!$projectOwner and isset($sourceProject->owner->id) and $sourceProject->owner->id == $openID) $projectOwner = true; + } + $this->view->sourceProjectName = $sourceProject->name_with_namespace; $this->view->targetProjectName = $targetProject->name_with_namespace; $this->view->sourceProjectURL = isset($sourceBranch->web_url) ? $sourceBranch->web_url : ''; @@ -260,8 +267,9 @@ class mr extends control $this->app->loadLang('productplan'); $product = $this->mr->getMRProduct($MR); - $this->view->compile = $this->loadModel('compile')->getById($MR->compileID); - $this->view->compileJob = $MR->jobID ? $this->job->getById($MR->jobID) : false; + $this->view->compile = $this->loadModel('compile')->getById($MR->compileID); + $this->view->compileJob = $MR->jobID ? $this->job->getById($MR->jobID) : false; + $this->view->projectOwner = $projectOwner; $this->view->title = $this->lang->mr->view; $this->view->MR = $MR; diff --git a/module/mr/model.php b/module/mr/model.php index 24cee99a05..9f81b753af 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -57,7 +57,7 @@ class mrModel extends model foreach($filterProjects as $gitlabID => $projects) { $projectIDList = array_keys($projects); - if(!empty($projectIDList)) $filterProjectSql .= "(gitlabID = {$gitlabID} and sourceProject ".helper::dbIN($projectIDList).") or "; + if(!empty($projectIDList)) $filterProjectSql .= "(gitlabID = {$gitlabID} and sourceProject " . helper::dbIN($projectIDList) . ") or "; } if($filterProjectSql) $filterProjectSql = '(' . substr($filterProjectSql, 0, -3) . ')'; // Remove last or. diff --git a/module/mr/view/view.html.php b/module/mr/view/view.html.php index 9305e5547b..0d3a3db451 100644 --- a/module/mr/view/view.html.php +++ b/module/mr/view/view.html.php @@ -119,7 +119,7 @@ id", $MR, 'button', 'edit');?> synced and $rawMR->state == 'closed') common::printIcon('mr', 'reopen', "mr=$MR->id", $MR, 'button', 'restart', 'hiddenwin', 'mergeButton'); ?> - id", $MR, 'button', 'trash', 'hiddenwin');?> + id", $MR, 'button', 'trash', 'hiddenwin');?>