use policies to protect sending email
This commit is contained in:
parent
bb0cba920a
commit
f7a111e976
2 changed files with 2 additions and 1 deletions
|
@ -9,6 +9,7 @@ class GlobalPolicy < BasePolicy
|
||||||
can! :log_in unless @user.access_locked?
|
can! :log_in unless @user.access_locked?
|
||||||
can! :access_api
|
can! :access_api
|
||||||
can! :access_git
|
can! :access_git
|
||||||
|
can! :receive_notifications
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -465,7 +465,7 @@ class NotificationService
|
||||||
end
|
end
|
||||||
|
|
||||||
users = users.to_a.compact.uniq
|
users = users.to_a.compact.uniq
|
||||||
users = users.reject(&:blocked?)
|
users = users.select { |u| u.can?(:receive_notifications) }
|
||||||
|
|
||||||
users.reject do |user|
|
users.reject do |user|
|
||||||
global_notification_setting = user.global_notification_setting
|
global_notification_setting = user.global_notification_setting
|
||||||
|
|
Loading…
Reference in a new issue