news消息已读修改

This commit is contained in:
huang 2016-03-11 10:49:17 +08:00
parent 440cd04414
commit 47ca79c317
1 changed files with 3 additions and 7 deletions

View File

@ -108,15 +108,11 @@ class NewsController < ApplicationController
def show
# 更新news对应的forge_messages的消息viewed字段
if @project
query_message_news = @news.forge_messages
query_message_news = ForgeMessage.where("forge_message_id =? and user_id =?", @news.id, User.current.id).first
else
query_message_news = @news.course_messages
end
query_message_news.each do |query|
if User.current.id == query.user_id
query.update_attributes(:viewed => true)
end
query_message_news = CourseMessage.where("course_message_id =? and user_id =?", @news.id, User.current.id).first
end
query_message_news.update_attribute(:viewed, true)
# 更新项目新闻的评阅的消息viewed字段
current_message_comments = @news.comments
current_message_comments.each do |current_message_comment|