优化用户留言页面

This commit is contained in:
huang 2015-09-18 14:04:02 +08:00
parent 90bf4a7c99
commit 81743143c2
1 changed files with 6 additions and 6 deletions

View File

@ -114,6 +114,7 @@ class UsersController < ApplicationController
end
@user_system_messages = SystemMessage.where("created_at >?", contrast_time).order("created_at desc")
# 当前用户查看消息,则设置消息为已读
# DO 待优化,只需查出符合条件的再更新
if params[:viewed] == "all"
course_querys = @user.course_messages
forge_querys = @user.forge_messages
@ -632,12 +633,11 @@ class UsersController < ApplicationController
redirect_to signin_url
return
end
# 更新用户留言消息状态
@user.journals_for_messages.each do |jour_message|
jour_message.user_feedback_messages.each do |userfeedback_message|
if User.current.id == userfeedback_message.user_id
userfeedback_message.update_attributes(:viewed => true)
end
# 自己访问自己的页面才更新消息状态
if User.current == @user
journals_messages = UserFeedbackMessage.where("user_id =? and journals_for_message_type =? and viewed =?", User.current.id, "JournalsForMessage", 0)
journals_messages.each do |journals_message|
journals_message.update_attributes(:viewed => true)
end
end
# end