Merge pull request #5945 from tchak/fix_send_to_instructeurs

Fix JSON.parse crashing on empty values
This commit is contained in:
Paul Chavard 2021-03-04 10:11:03 +01:00 committed by GitHub
commit e5a9e90304
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -72,7 +72,8 @@ module Instructeurs
end
def send_to_instructeurs
recipients = Instructeur.find(JSON.parse(params[:recipients]))
recipients = params['recipients'].presence || [].to_json
recipients = Instructeur.find(JSON.parse(recipients))
recipients.each do |recipient|
recipient.follow(dossier)

View file

@ -138,7 +138,8 @@ module Instructeurs
end
def update_displayed_fields
procedure_presentation.update_displayed_fields(JSON.parse(params[:values]))
values = params['values'].presence || [].to_json
procedure_presentation.update_displayed_fields(JSON.parse(values))
redirect_back(fallback_location: instructeur_procedure_url(procedure))
end