diff --git a/app/notifiers/base_notifier.rb b/app/notifiers/base_notifier.rb index e75a505c7..a9224a5df 100644 --- a/app/notifiers/base_notifier.rb +++ b/app/notifiers/base_notifier.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true class BaseNotifier def self.ignored?(user) - user.ignored_notification?(underscored_name) + user.ignored_notification?(underscored_name) || globally_ignored?(underscored_name) + end + + def self.globally_ignored?(notification_name) + AppConfig.globally_ignored_notifications.include?(notification_name) end def self.underscored_name diff --git a/config/app_config.rb b/config/app_config.rb index bc102217b..60d25245a 100644 --- a/config/app_config.rb +++ b/config/app_config.rb @@ -12,6 +12,13 @@ def self.default_mailer_url_host # Application settings + def self.globally_ignored_notifications + (env['GLOBALLY_IGNORED_NOTIFICATIONS'] || ''). + split(','). + map { |name| name.strip.downcase }. + compact + end + def self.managed_email_username env['MANAGED_EMAIL_USERNAME'] end diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 083f1de5d..f65f00164 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -21,6 +21,7 @@ PROMO_CODE SEND_SMS_NOTIFICATIONS APP_HOST VALIDATE_SWEDISH_SSN +GLOBALLY_IGNORED_NOTIFICATIONS ``` ## Application config