From 98a8702ba6ef2f92d60f58eef0c7f968f5527f62 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 10 Aug 2016 16:49:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=B0=81=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E7=9A=84pull=20request=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/pull_requests_helper.rb | 5 +++++ app/views/pull_requests/_show.html.erb | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/helpers/pull_requests_helper.rb b/app/helpers/pull_requests_helper.rb index fc9e7b4c8..03c8358ab 100644 --- a/app/helpers/pull_requests_helper.rb +++ b/app/helpers/pull_requests_helper.rb @@ -14,6 +14,11 @@ module PullRequestsHelper User.find(user_id).try(:login) end + # 获取接受PullRequest用户的信息 + def accept_user pull_request_id + PullRequest.where(:pull_request_id => pull_request_id).first + end + def get_state state case state when "open","reopened" diff --git a/app/views/pull_requests/_show.html.erb b/app/views/pull_requests/_show.html.erb index 198035850..d982ffd8c 100644 --- a/app/views/pull_requests/_show.html.erb +++ b/app/views/pull_requests/_show.html.erb @@ -24,7 +24,9 @@ <% else %> <% if @request.state == "merged" %>
- <%#= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %>于<%= time_tag(@request.created_at) %> 前合并
+ <% unless accept_user(@request.id).blank? %> + <%= link_to User.find(accept_user(@request.id).user_id), user_path(accept_user(@request.id).user_id), :class => "link-blue" %> 于 <%= time_tag(accept_user(@request.id).created_at) %> 前合并
+ <% end %>

改动已合并至<%= @request.target_branch %>

<% else %>