diff --git a/app/controllers/api_particulier/reporters_controller.rb b/app/controllers/api_particulier/reporters_controller.rb index e06c18f80..c677fc50c 100644 --- a/app/controllers/api_particulier/reporters_controller.rb +++ b/app/controllers/api_particulier/reporters_controller.rb @@ -28,6 +28,6 @@ def reporter_emails end def reporters_config - @reporters_config ||= Rails.application.credentials.api_particulier_reporters + Rails.application.credentials.api_particulier_reporters || {} end end diff --git a/app/interactors/datapass_webhook/api_particulier/notify_reporters.rb b/app/interactors/datapass_webhook/api_particulier/notify_reporters.rb index 052f237f2..ddfd08549 100644 --- a/app/interactors/datapass_webhook/api_particulier/notify_reporters.rb +++ b/app/interactors/datapass_webhook/api_particulier/notify_reporters.rb @@ -15,7 +15,11 @@ def groups_to_notify end def reporters_groups_config - Rails.application.credentials.api_particulier_reporters.keys + reporters_config.keys + end + + def reporters_config + Rails.application.credentials.api_particulier_reporters || {} end def scopes diff --git a/app/mailers/api_particulier/reporters_mailer.rb b/app/mailers/api_particulier/reporters_mailer.rb index 032974b63..0a4f12a43 100644 --- a/app/mailers/api_particulier/reporters_mailer.rb +++ b/app/mailers/api_particulier/reporters_mailer.rb @@ -6,6 +6,8 @@ class APIParticulier::ReportersMailer < APIParticulierMailer approve ].each do |event| define_method(event) do + return if reporters_config.blank? + groups = params[:groups].map(&:to_sym) return if reporter_emails(groups).empty?