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