fork成功不跳转提示
This commit is contained in:
parent
308b050612
commit
43a4e0a2bf
|
@ -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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<% if @message %>
|
||||
<div class="flash error">
|
||||
<%= @message %>
|
||||
</div>
|
||||
<div class="flash error"><%= @message %></div>
|
||||
<% end %>
|
||||
|
||||
<% if @fork_pr_message %>
|
||||
<div class="flash notice">您的Pull Request请求已成功发送至源项目:<%= @fork_project_name %></div>
|
||||
<% end %>
|
Loading…
Reference in New Issue