|
|
|
@ -438,13 +438,27 @@ class UsersController < ApplicationController
|
|
|
|
|
# Description 所有动态
|
|
|
|
|
where_condition = nil;
|
|
|
|
|
# where_condition = "act_type <> 'JournalsForMessage'"
|
|
|
|
|
user_ids = []
|
|
|
|
|
if @user == User.current
|
|
|
|
|
watcher = User.watched_by(@user)
|
|
|
|
|
watcher.push(User.current)
|
|
|
|
|
activity = Activity.where(where_condition).where('user_id in (?)', watcher).order('id desc')
|
|
|
|
|
user_ids = watcher.map{|x| x.id}
|
|
|
|
|
else
|
|
|
|
|
activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
|
|
|
|
|
user_ids << @user.id
|
|
|
|
|
end
|
|
|
|
|
activity = Activity.where(where_condition).where(user_id: user_ids).order('id desc')
|
|
|
|
|
|
|
|
|
|
#Issue
|
|
|
|
|
# act_ids = Activity.where(act_type: 'Issue', user_id: user_ids).select('act_id').map{|x| x.act_id}
|
|
|
|
|
# project_ids = Issue.where(id: act_ids).select('distinct project_id').map{|x| x.project_id}
|
|
|
|
|
# valid_p_ids = []
|
|
|
|
|
# Project.where(id: project_ids).each do |x|
|
|
|
|
|
# x.visible?(User.current)
|
|
|
|
|
# valid_p_ids << x.id
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
# activity = Activity.where(act_id: Issue.where(id: act_ids, project_id: valid_p_ids).map{|x| x.id}).order('id desc')
|
|
|
|
|
|
|
|
|
|
# activity = activity.reject { |e|
|
|
|
|
|
# e.act.nil? ||
|
|
|
|
|
# (!User.current.admin? && !e.act.nil?
|
|
|
|
@ -457,11 +471,6 @@ class UsersController < ApplicationController
|
|
|
|
|
@activity_count = activity.count
|
|
|
|
|
@activity_pages = Paginator.new @activity_count, pre_count, params['page']
|
|
|
|
|
@activity = activity.slice(@activity_pages.offset,@activity_pages.per_page)
|
|
|
|
|
# @activity = @activity.reject { |e|
|
|
|
|
|
# ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
|
|
|
|
|
# ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
|
|
|
|
|
# ((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
|
|
|
|
|
# }
|
|
|
|
|
@state = 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|