diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index ff74eb9f3..0b6a73440 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -92,21 +92,21 @@ class PullRequestsController < ApplicationController if compare_pull_request(source_branch, target_project_id, target_branch) # 如果传送了目标项目ID即向fork源项目发送请求 # if params[:forked_project_id] && params[:source_project] == "forked_project_name" - if params[:target_project_id].to_i != @project.id + if !params[:target_project_id].blank? 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(params[:target_project_id]).try(:name) @fork_pr_message = true if @fork_project_name # 发送消息 - send_message(User.current.id, target_project_id, title) + #send_message(User.current.id, target_project_id, title) # 创建Trustie数据 - PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id) + #PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => target_project_id) else request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch) # 发送消息 - send_message(User.current.id, @project.id, title) + #send_message(User.current.id, @project.id, title) # 创建Trustie数据 - PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id) + #PullRequest.create(:pull_request_id => request.id, :user_id => User.current.id, :status => 1, :project_id => @project.id) respond_to do |format| format.js{redirect_to project_pull_request_path(request.id, :project_id => @project.id)} end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8301407ae..e9bbcaafe 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -75,7 +75,7 @@ module ApplicationHelper # 通过系统外部用户名查找用户,如果用户不存在则用邮箱替换 def get_user_by_login_and login user = User.find_by_login(login) - user.nil? ? User.find(2) : user + (user.nil? || login == "root") ? User.find(2) : user end # 重置user_path,目的是将id转换成用户名 diff --git a/app/views/pull_requests/_pull_requests_list.html.erb b/app/views/pull_requests/_pull_requests_list.html.erb index 57a1874ca..2258962a6 100644 --- a/app/views/pull_requests/_pull_requests_list.html.erb +++ b/app/views/pull_requests/_pull_requests_list.html.erb @@ -12,7 +12,7 @@ <%= link_to "", project_pull_request_path(request.id, :project_id => @project.id), :class => "issues_icons_mes fr mr5 ml5" %>
-

由 <%= link_to User.find(request.author.id).try(:show_name), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前

+

由 <%= link_to get_user_by_login_and(request.author.try(:username)).try(:show_name), user_path(get_user_by_login_and(request.author.try(:username))), :class => "linkBlue2" %> 创建于<%= time_tag(request.created_at) %>前

<%= time_tag(request.updated_at) %>前更新

<%= @project.name+"/"+request.source_branch %>合并到<%= request.target_branch %>

diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 00b141d31..54eea89c0 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -195,7 +195,7 @@ <% end %> + <%# end %>--> <% end %> \ No newline at end of file