From 80647364ffaad3d100c64dd8a1ab32e8a9b4bcf9 Mon Sep 17 00:00:00 2001 From: "http://jneen.net/" Date: Wed, 19 Jul 2017 11:17:29 -0700 Subject: move the ability check to reject_users_without_access --- app/services/notification_recipient_service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/services') diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb index 9ac561e4bd2..1abf0335dc4 100644 --- a/app/services/notification_recipient_service.rb +++ b/app/services/notification_recipient_service.rb @@ -253,7 +253,6 @@ class NotificationRecipientService end users = users.to_a.compact.uniq - users = users.select { |u| u.can?(:receive_notifications) } users.reject do |user| global_notification_setting = user.global_notification_setting @@ -287,6 +286,8 @@ class NotificationRecipientService end def reject_users_without_access(recipients, target) + recipients = recipients.select { |u| u.can?(:receive_notifications) } + ability = case target when Issuable :"read_#{target.to_ability_name}" -- cgit v1.2.3