优化issue显示代码

This commit is contained in:
huang 2015-10-08 17:42:48 +08:00
parent 2aeebfe645
commit fce872a6a5
1 changed files with 2 additions and 6 deletions

View File

@ -113,12 +113,8 @@ class IssuesController < ApplicationController
def show def show
# 当前用户查看指派给他的缺陷消息,则设置消息为已读 # 当前用户查看指派给他的缺陷消息,则设置消息为已读
query = @issue.forge_messages query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
query.each do |m| query.update_attribute(:viewed, true) unless query.nil?
if m.user_id == User.current.id
m.update_attribute(:viewed, true)
end
end
# 缺陷状态更新 # 缺陷状态更新
query_journals = @issue.journals query_journals = @issue.journals
query_journals.each do |query_journal| query_journals.each do |query_journal|