forked from Trustie/forgeplus
fixed:同一方向pullrequest不允许存在
This commit is contained in:
parent
6bcdc20500
commit
bb720d20c1
|
@ -14,11 +14,19 @@ class Api::V1::Projects::Pulls::PullsController < Api::V1::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def reopen
|
def reopen
|
||||||
@result_object = Api::V1::Projects::Pulls::ReopenService.call(@project, @pull_request, current_user)
|
can_merge = @project&.pull_requests.where(head: @pull_request.head, base: @pull_request.base, status: 0, is_original: @pull_request.is_original, fork_project_id: @pull_request.fork_project_id)
|
||||||
if @result_object
|
if can_merge.present?
|
||||||
render_ok
|
render json: {
|
||||||
|
status: -2,
|
||||||
|
message: "在这些分支之间的合并请求已存在:<a href='/#{@project.owner.login}/#{@project.identifier}/pulls/#{can_merge.first.id}''>#{can_merge.first.try(:title)}</a>",
|
||||||
|
}
|
||||||
else
|
else
|
||||||
render_error("合并请求重新打开失败!")
|
@result_object = Api::V1::Projects::Pulls::ReopenService.call(@project, @pull_request, current_user)
|
||||||
|
if @result_object
|
||||||
|
render_ok
|
||||||
|
else
|
||||||
|
render_error("合并请求重新打开失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue