diff --git a/module/mr/control.php b/module/mr/control.php index 0ce7e9a13b..346deda0ff 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -310,7 +310,11 @@ class mr extends control } /* The type of variable `$rawMR->message` is string. This is different with apiCreateMR. */ - if(isset($rawMR->message)) return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->sudo, $rawMR->message), 'locate' => helper::createLink('mr', 'view', "mr={$MRID}"))); + if(isset($rawMR->message)) + { + $errorMessage = $this->mr->convertApiError($rawMR->message); + return $this->send(array('result' => 'fail', 'message' => sprintf($this->lang->mr->apiError->sudo, $errorMessage), 'locate' => helper::createLink('mr', 'view', "mr={$MRID}"))); + } return $this->send(array('result' => 'fail', 'message' => $this->lang->mr->mergeFailed, 'locate' => helper::createLink('mr', 'view', "mr={$MRID}"))); } diff --git a/module/mr/lang/en.php b/module/mr/lang/en.php index a8dc3df6cb..8cb69dabec 100644 --- a/module/mr/lang/en.php +++ b/module/mr/lang/en.php @@ -112,9 +112,11 @@ $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->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->from = "from"; $lang->mr->to = "to"; diff --git a/module/mr/lang/zh-cn.php b/module/mr/lang/zh-cn.php index cc843282fc..1bed150255 100644 --- a/module/mr/lang/zh-cn.php +++ b/module/mr/lang/zh-cn.php @@ -112,9 +112,11 @@ $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->errorLang[1] = '源项目分支与目标项目分支不能相同'; $lang->mr->errorLang[2] = '存在另外一个同样的合并请求在源项目分支中: ID%u'; +$lang->mr->errorLang[3] = '权限不足'; $lang->mr->from = "从"; $lang->mr->to = "合并到";