fork成功不跳转提示
This commit is contained in:
parent
308b050612
commit
43a4e0a2bf
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
class PullRequestsController < ApplicationController
|
class PullRequestsController < ApplicationController
|
||||||
before_filter :find_project_and_repository
|
before_filter :find_project_and_repository
|
||||||
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new]
|
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new]
|
||||||
|
@ -61,14 +62,16 @@ class PullRequestsController < ApplicationController
|
||||||
begin
|
begin
|
||||||
# 如果传送了目标项目ID,则PR请求发至目标项目
|
# 如果传送了目标项目ID,则PR请求发至目标项目
|
||||||
if params[:forked_project_id] && params[:source_project] == "forked_project_name"
|
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)
|
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
|
else
|
||||||
request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch)
|
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|
|
respond_to do |format|
|
||||||
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)}
|
||||||
end
|
end
|
||||||
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
@message = e.message
|
@message = e.message
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<% if @message %>
|
<% if @message %>
|
||||||
<div class="flash error">
|
<div class="flash error"><%= @message %></div>
|
||||||
<%= @message %>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
<% if @fork_pr_message %>
|
||||||
|
<div class="flash notice">您的Pull Request请求已成功发送至源项目:<%= @fork_project_name %></div>
|
||||||
<% end %>
|
<% end %>
|
Loading…
Reference in New Issue