diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 7f1797f73..7db6e592e 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -1,3 +1,4 @@ + class PullRequestsController < ApplicationController before_filter :find_project_and_repository before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new] @@ -61,13 +62,15 @@ class PullRequestsController < ApplicationController begin # 如果传送了目标项目ID,则PR请求发至目标项目 if params[:forked_project_id] && params[:source_project] == "forked_project_name" - target_project_id = params[:target_project_id] + target_project_id = params[:forked_project_id].to_i request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id) + @fork_project_name = Project.find(@project.forked_from_project_id).try(:name) + @fork_pr_message = true if @fork_project_name else request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch) - end - respond_to do |format| - format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)} + respond_to do |format| + format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)} + end end rescue Exception => e @message = e.message diff --git a/app/views/pull_requests/_error_message.html.erb b/app/views/pull_requests/_error_message.html.erb index 6081f07c4..9d0dd5a21 100644 --- a/app/views/pull_requests/_error_message.html.erb +++ b/app/views/pull_requests/_error_message.html.erb @@ -1,5 +1,7 @@ <% if @message %> -