diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e3480b238..d1eeda707 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -102,22 +102,22 @@ class UsersController < ApplicationController # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment) def user_messages unless User.current.logged? - render_403 + redirect_to signin_url return 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 + 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 @@ -540,6 +540,10 @@ class UsersController < ApplicationController # modified by fq def user_newfeedback + unless User.current.logged? + redirect_to signin_url + return + end # 更新用户留言消息状态 @user.journals_for_messages.each do |jour_message| jour_message.user_feedback_messages.each do |userfeedback_message| diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 1d288b4b8..c3c1a447b 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -29,7 +29,11 @@