Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/notification_recipient.rb')
-rw-r--r--app/models/notification_recipient.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/notification_recipient.rb b/app/models/notification_recipient.rb
index b3eaed154e2..caa24377791 100644
--- a/app/models/notification_recipient.rb
+++ b/app/models/notification_recipient.rb
@@ -38,6 +38,7 @@ class NotificationRecipient
return !unsubscribed? if @type == :subscription
return false unless suitable_notification_level?
+ return false if email_blocked?
# check this last because it's expensive
# nobody should receive notifications if they've specifically unsubscribed
@@ -95,6 +96,15 @@ class NotificationRecipient
end
end
+ def email_blocked?
+ return false if Feature.disabled?(:block_emails_with_failures)
+
+ recipient_email = user.notification_email_for(@group)
+
+ Gitlab::ApplicationRateLimiter.peek(:permanent_email_failure, scope: recipient_email) ||
+ Gitlab::ApplicationRateLimiter.peek(:temporary_email_failure, scope: recipient_email)
+ end
+
def has_access?
DeclarativePolicy.subject_scope do
break false unless user.can?(:receive_notifications)