"我的动态"显示当前用户的个人动态

This commit is contained in:
cxt 2015-09-11 16:53:09 +08:00
parent 7e5093d0d2
commit 86f0889f5b
1 changed files with 1 additions and 1 deletions

View File

@ -863,7 +863,7 @@ class UsersController < ApplicationController
when "project_message"
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10)
when "current_user"
@user_activities = UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10)
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10)
else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
end