From 2cee4448ea30f129e09d632864b680f92cf78b93 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 29 Nov 2016 18:19:29 +0800 Subject: [PATCH] =?UTF-8?q?pullrequest=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=EF=BC=88=E6=9C=AA=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 14 ++++++++++++++ app/views/users/_user_message_forge.html.erb | 10 +++------- 2 files changed, 17 insertions(+), 7 deletions(-) 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) %>