Skip to content

Commit

Permalink
Make api_particulier_reporters config more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
skelz0r committed Aug 27, 2024
1 parent 79c2228 commit a5d6ebf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api_particulier/reporters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/mailers/api_particulier/reporters_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit a5d6ebf

Please sign in to comment.