diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-09 21:12:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-09 21:12:57 +0300 |
commit | 7c0e5472c80f1826b36916a95e6f9d84a7b68fe3 (patch) | |
tree | 91e24facb11469a31da6566ed5d59d7298984082 /app/models/notification_recipient.rb | |
parent | 427dbb30f037eb6697fc14852966ebff5d488a43 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/notification_recipient.rb')
-rw-r--r-- | app/models/notification_recipient.rb | 10 |
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) |