Skip to content

Commit

Permalink
Merge pull request #9094 from alphagov/phone-number-deletion-two
Browse files Browse the repository at this point in the history
'Refactor' of Delete blank contacts function
  • Loading branch information
callumknights authored May 31, 2024
2 parents cd622b0 + 2d5fd5d commit 23902fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin/worldwide_offices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def update

update_params[:service_ids] ||= []

if update_params.dig(:contact_attributes, :contact_numbers_attributes)
update_params.dig(:contact_attributes, :contact_numbers_attributes).each do |_id, contact_number_attribute|
if (contact_numbers_attributes = update_params.dig(:contact_attributes, :contact_numbers_attributes))
contact_numbers_attributes.each do |_id, contact_number_attribute|
contact_number_attribute[:_destroy] = true if contact_number_attribute[:label].empty? && contact_number_attribute[:number].empty?
end
end
Expand Down

0 comments on commit 23902fa

Please sign in to comment.