diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 4dd3399a3..14064c11f 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -90,6 +90,20 @@ module UsersHelper end end + # 获取pullrequest消息状态 + def pull_request_message_status ma + case ma.status + when 1 + "创建了PullRequest:" + when 2 + "接受了您的PullRequest:" + when 3 + "重新打开了PullRequest:" + when 4 + "关闭了您的PullRequest:" + end + + end # 判断当前用户能否对消息进行操作 def allow_to_show applied_message (User.current.id == applied_message.user_id && applied_message.status == 1) ? true : false diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 95a079714..c28c40065 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -206,16 +206,12 @@ <%=link_to User.find(ma.forge_message.author).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> - <% if ma.status == 1 %> - 创建了PullRequest: - <% elsif ma.status == 3 %> - 重新打开了PullRequest: - <% end %> + <%= pull_request_message_status(ma) %>
  • - <%= link_to "#{ma.forge_message.forge_message_id.title}", - {:controller => 'pull_requests', :action => 'show', :id => ma.forge_message.project_id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> + <%= link_to "#{ma.forge_message.forge_message_id.title}", {:controller => 'pull_requests', :action => 'show', :id => ma.forge_message.project_id }, + :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
  • <%= time_tag(ma.created_at).html_safe %>