Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Globbally ignored notifications from ENV #754

Merged
merged 3 commits into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/notifiers/base_notifier.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions config/app_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ PROMO_CODE
SEND_SMS_NOTIFICATIONS
APP_HOST
VALIDATE_SWEDISH_SSN
GLOBALLY_IGNORED_NOTIFICATIONS
```

## Application config
Expand Down