邮件发送时,单个收件人会报错
This commit is contained in:
parent
0325554d24
commit
5a876d9df1
|
@ -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
|
||||
|
||||
|
|
|
@ -775,9 +775,9 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
elsif reps.is_a? String
|
||||
u = User.find_by_mail(r)
|
||||
u = User.find_by_mail(reps)
|
||||
if u && u.mail_notification == 'all'
|
||||
r_reps << r
|
||||
r_reps << reps
|
||||
end
|
||||
end
|
||||
r_reps
|
||||
|
|
|
@ -766,7 +766,7 @@ class User < Principal
|
|||
# * nil with options[:global] set : check if user has at least one role allowed for this action,
|
||||
# or falls back to Non Member / Anonymous permissions depending if the user is logged
|
||||
def allowed_to?(action, context, options={}, &block)
|
||||
if context && context.is_a?(Project)
|
||||
if Project === context
|
||||
return false unless context.allows_to?(action)
|
||||
# Admin users are authorized for anything else
|
||||
return true if admin?
|
||||
|
@ -779,7 +779,7 @@ class User < Principal
|
|||
(block_given? ? yield(role, self) : true)
|
||||
}
|
||||
#添加课程相关的权限判断
|
||||
elsif context && context.is_a?(Course)
|
||||
elsif Course === context
|
||||
return false unless context.allows_to?(action)
|
||||
# Admin users are authorized for anything else
|
||||
return true if admin?
|
||||
|
|
Loading…
Reference in New Issue