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 %> - <%# 更新访问数,刷新的时候更新访问次数 %> <% update_visiti_count @user %> diff --git a/app/views/users/course_community.html.erb b/app/views/users/course_community.html.erb index 724bb730c..c31e5aa64 100644 --- a/app/views/users/course_community.html.erb +++ b/app/views/users/course_community.html.erb @@ -15,7 +15,7 @@
  • <%= link_to "论坛动态", {:controller => "users", :action => "course_community", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey" %>
  • <%= link_to "问卷动态", {:controller => "users", :action => "course_community", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey" %>
  • <%= link_to "班级留言", {:controller => "users", :action => "course_community", :type => "course_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
  • -
  • <%= link_to "个人留言", {:controller => "users", :action => "course_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
  • + <% end %> diff --git a/app/views/users/project_community.html.erb b/app/views/users/project_community.html.erb index 64ce8ce9e..36b8591b5 100644 --- a/app/views/users/project_community.html.erb +++ b/app/views/users/project_community.html.erb @@ -13,7 +13,7 @@ :class => "homepagePostTypeMine postTypeGrey" %>
  • <%= link_to "问题动态", {:controller => "users", :action => "project_community", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
  • <%= link_to "论坛动态", {:controller => "users", :action => "project_community", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
  • -
  • <%= link_to "个人留言", {:controller => "users", :action => "project_community", :type => "user_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %>
  • + <% end %>