diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c5d5962b2..314f63069 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1825,7 +1825,11 @@ class UsersController < ApplicationController messages.each do |message_all| mess = message_all.message unless (message_all.message_type == 'CourseMessage' && mess && mess.course && mess.course.is_delete == 1) - @message_alls << mess + if (message_all.message_type =="SystemMessage" && !many_days_ago(mess.created_at, 30)) + next + else + @message_alls << mess + end end end @message_count = @message_alls.count @@ -2135,6 +2139,9 @@ class UsersController < ApplicationController when "course_journals" container_type = 'Course' act_type = 'JournalsForMessage' + when "current_user" + container_type = 'Principal' + act_type = 'Principal' when "all" container_type = 'all' act_type = 'all' @@ -2143,12 +2150,15 @@ class UsersController < ApplicationController if container_type != '' && container_type != 'all' if container_type == 'Course' sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'" + elsif container_type == 'Principal' && act_type == 'Principal' + sql = "user_id = #{@user.id} and (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" end if User.current != @user sql += " and user_id = #{@user.id}" end else - sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" + sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" + + "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " if container_type != 'all' && User.current != @user sql = "user_id = #{@user.id} and(" + sql + ")" end @@ -2181,6 +2191,9 @@ class UsersController < ApplicationController when "project_message" container_type = 'Project' act_type = 'Message' + when "current_user" + container_type = 'Principal' + act_type = 'Principal' when "all" container_type = 'all' act_type = 'all' @@ -2189,12 +2202,15 @@ class UsersController < ApplicationController if container_type != '' && container_type != 'all' if container_type == 'Project' sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'" + elsif container_type == 'Principal' && act_type == 'Principal' + sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}))" end if User.current != @user sql += " and user_id = #{@user.id}" end else - sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + + "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " if container_type != 'all' && User.current != @user sql = "user_id = #{@user.id} and(" + sql + ")" end diff --git a/app/views/layouts/base_project_community.html.erb b/app/views/layouts/base_project_community.html.erb index e61bd67cf..ee8ed23db 100644 --- a/app/views/layouts/base_project_community.html.erb +++ b/app/views/layouts/base_project_community.html.erb @@ -66,11 +66,6 @@ <% end %> -