修复申请加入项目被审批后,出现的审批人名字错误的缺陷

This commit is contained in:
daiao 2017-01-12 10:19:10 +08:00
parent 13e17dd5a3
commit fd61782739
3 changed files with 12 additions and 6 deletions

View File

@ -2071,7 +2071,7 @@ class UsersController < ApplicationController
@applied_message_alls << mess
end
elsif message_all.message_type == "ForgeMessage"
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0 && PullRequest.where(:pull_request_id => mess.forge_message_id).first.user_id != User.current.id
user_id = PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).first.id
if ForgeMessage.where("status in (1,3) and user_id != #{user_id} and pull_request_id = #{mess.forge_message_id}")
@applied_message_alls << mess
@ -2289,7 +2289,7 @@ class UsersController < ApplicationController
@message_alls << mess
end
elsif message_all.message_type == "ForgeMessage"
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0
if mess.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).count > 0 && PullRequest.where(:pull_request_id => mess.forge_message_id).first.user_id != User.current.id
user_id = PullRequest.where(:pull_request_id => mess.forge_message_id, :status => [1, 3]).first.id
if ForgeMessage.where("status in (1,3) and user_id != #{user_id} and pull_request_id = #{mess.forge_message_id}")
@message_alls << mess

View File

@ -207,6 +207,12 @@
<% author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
<li><a href="<%= project_pull_requests_path(ma.project_id) %>" target="_blank" title="<%= User.find(author.id).show_name %> <%= pull_request_message_status(ma) %> <%= send_message_user[0].title %>"><span class="shadowbox_news_user"><%= User.find(author.id).show_name %> </span><%= pull_request_message_status(ma) %> <%= send_message_user[0].title %></a></li>
<% end %>
<% elsif ma.class == BlogMessage %>
<% if ma.blog_message_type == "BlogComment" %>
<% user_id = User.find(BlogComment.find(ma.blog_commont_id).blog.author_id) %>
<% blog_id = BlogComment.find(ma.blog_commont_id).root_id %>
<li><a href="<%= user_blog_blog_comment_path(:user_id => user_id, :blog_id => ma.blog_id, :id => blog_id) %>" target="_blank" title="<%= User.find(ma.user_operator_id).show_name %> 回复了博客:<%= message_content(ma.content) %>"><span class="shadowbox_news_user"><%= User.find(ma.user_operator_id).show_name %> </span>回复了博客:<%= message_content(ma.content) %></a></li>
<% end %>
<% elsif ma.class == MemoMessage %>
<% if ma.memo_type == "Memo" && !ma.memo.nil? && !ma.memo.author.nil? %>
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%></a></li>

View File

@ -7,25 +7,25 @@
<% elsif ma.status == 2 %>
<span class="fontGrey3" style="font-size:14px;">已处理</span>
<% elsif ma.status == 4 %>
<% operator_message = AppliedMessage.where("applied_id=? and status = 4", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已拒绝">
<%= operator %>已拒绝
</span>
<% elsif ma.status == 5 %>
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,5)", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 4", ma.applied_id, ma.applied_user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已拒绝">
<%= operator %>已拒绝
</span>
<% elsif ma.status == 6 %>
<% operator_message = AppliedMessage.where("applied_id=? and status = 6", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 6", ma.applied_id, ma.user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已同意">
<%= operator %>已同意
</span>
<% elsif ma.status == 7 %>
<% operator_message = AppliedMessage.where("applied_id=? and status not in (2,7)", ma.applied_id).first %>
<% operator_message = AppliedMessage.where("applied_id=? and user_id=? and status = 6", ma.applied_id, ma.applied_user_id).first %>
<% operator = User.find(operator_message.applied_user_id).show_name %>
<span class="fontGrey3" style="font-size:14px" title="<%= operator %>已同意">
<%= operator %>已同意