* Finish task #48108.
This commit is contained in:
@@ -53,6 +53,9 @@ class mr extends control
|
||||
/* Load lang from compile module */
|
||||
$this->app->loadLang('compile');
|
||||
|
||||
$openIDList = array();
|
||||
if(!$this->app->user->admin) $openIDList = $this->loadModel('gitlab')->getGitLabListByAccount($this->app->user->account);
|
||||
|
||||
$this->view->title = $this->lang->mr->common . $this->lang->colon . $this->lang->mr->browse;
|
||||
$this->view->MRList = $MRList;
|
||||
$this->view->projects = $projects;
|
||||
@@ -61,6 +64,7 @@ class mr extends control
|
||||
$this->view->param = $param;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->openIDList = $openIDList;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -190,8 +194,12 @@ class mr extends control
|
||||
|
||||
$MR = $this->mr->getByID($id);
|
||||
|
||||
if($MR->synced)
|
||||
{
|
||||
$res = $this->mr->apiDeleteMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
|
||||
if(isset($res->message)) return print(js::alert($this->mr->convertApiError($res->message)));
|
||||
}
|
||||
$this->dao->delete()->from(TABLE_MR)->where('id')->eq($id)->exec();
|
||||
$this->mr->apiDeleteMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
|
||||
|
||||
die(js::locate(inlink('browse'), 'parent'));
|
||||
}
|
||||
|
||||
@@ -113,10 +113,12 @@ $lang->mr->closeSuccess = "Merge request closed.";
|
||||
$lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and target";
|
||||
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
|
||||
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
|
||||
$lang->mr->apiErrorMap[4] = "403 Forbidden";
|
||||
|
||||
$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';
|
||||
$lang->mr->errorLang[3] = "Unauthorized";
|
||||
$lang->mr->errorLang[4] = 'Permission denied';
|
||||
|
||||
$lang->mr->from = "from";
|
||||
$lang->mr->to = "to";
|
||||
|
||||
@@ -113,10 +113,12 @@ $lang->mr->closeSuccess = "已关闭合并请求。";
|
||||
$lang->mr->apiErrorMap[1] = "You can't use same project/branch for source and target";
|
||||
$lang->mr->apiErrorMap[2] = "/Another open merge request already exists for this source branch: !([0-9]+)/";
|
||||
$lang->mr->apiErrorMap[3] = "401 Unauthorized";
|
||||
$lang->mr->apiErrorMap[4] = "403 Forbidden";
|
||||
|
||||
$lang->mr->errorLang[1] = '源项目分支与目标项目分支不能相同';
|
||||
$lang->mr->errorLang[2] = '存在另外一个同样的合并请求在源项目分支中: ID%u';
|
||||
$lang->mr->errorLang[3] = '权限不足';
|
||||
$lang->mr->errorLang[4] = '权限不足';
|
||||
|
||||
$lang->mr->from = "从";
|
||||
$lang->mr->to = "合并到";
|
||||
|
||||
@@ -82,11 +82,12 @@
|
||||
<?php endif;?>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$canDelete = ($app->user->admin or $projects[$MR->gitlabID][$MR->sourceProject]->owner->id === $openIDList[$MR->gitlabID]) ? '' : 'disabled';
|
||||
common::printLink('mr', 'view', "mr={$MR->id}", '<i class="icon icon-eye"></i>', '', "title='{$lang->mr->view}' class='btn btn-info'");
|
||||
common::printIcon('mr', 'edit', "mr={$MR->id}", $MR, 'list');
|
||||
common::printLink('mr', 'diff', "mr={$MR->id}", '<i class="icon icon-diff"></i>', '', "title='{$lang->mr->viewDiff}' class='btn btn-info'");
|
||||
common::printLink('mr', 'link', "mr={$MR->id}", '<i class="icon icon-link"></i>', '', "title='{$lang->mr->link}' class='btn btn-info'" . ($MR->linkButton == false ? 'disabled' : ''));
|
||||
common::printLink('mr', 'delete', "mr={$MR->id}", '<i class="icon icon-trash"></i>', 'hiddenwin', "title='{$lang->mr->delete}' class='btn btn-info'");
|
||||
common::printLink('mr', 'delete', "mr={$MR->id}", '<i class="icon icon-trash"></i>', 'hiddenwin', "title='{$lang->mr->delete}' class='btn btn-info {$canDelete}'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user