diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1fac6737b..5bd124fb9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -106,16 +106,18 @@ class UsersController < ApplicationController return end # 当前用户查看消息,则设置消息为已读 - # course_querys = @user.course_messages - # forge_querys = @user.forge_messages - # user_querys = @user.user_feedback_messages - # forum_querys = @user.memo_messages - # if User.current.id == @user.id - # course_querys.update_all(:viewed => true) - # forge_querys.update_all(:viewed => true) - # user_querys.update_all(:viewed => true) - # forum_querys.update_all(:viewed => true) - # end + if params[:viewed] == "all" + course_querys = @user.course_messages + forge_querys = @user.forge_messages + user_querys = @user.user_feedback_messages + forum_querys = @user.memo_messages + if User.current.id == @user.id + course_querys.update_all(:viewed => true) + forge_querys.update_all(:viewed => true) + user_querys.update_all(:viewed => true) + forum_querys.update_all(:viewed => true) + end + end # @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count case params[:type] when nil diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 33c51760c..31fd7a6bd 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -29,6 +29,11 @@