Bulk NS change: track untouched domains

This commit is contained in:
Karl Erik Õunapuu 2020-12-30 12:46:51 +02:00
parent 8bb0fd80d1
commit af0a0611ce
No known key found for this signature in database
GPG key ID: C9DD647298A34764
4 changed files with 20 additions and 15 deletions

View file

@ -48,22 +48,25 @@ class Registrar
parsed_response = JSON.parse(response.body, symbolize_names: true)
if response.code == '200'
notices = [t('.replaced')]
notices << "#{t('.affected_domains')}: " \
"#{parsed_response[:data][:affected_domains].join(', ')}"
if parsed_response[:data][:skipped_domains]
notices << "#{t('.skipped_domains')}: " \
"#{parsed_response[:data][:skipped_domains].join(', ')}"
end
flash[:notice] = notices.join(', ')
redirect_to registrar_domains_url
redirect_to(registrar_domains_url,
flash: { notice: compose_notice_message(parsed_response) })
else
@api_errors = parsed_response[:message]
render file: 'registrar/bulk_change/new', locals: { active_tab: :nameserver }
end
end
def compose_notice_message(res)
notices = ["#{t('.replaced')}. #{t('.affected_domains')}: " \
"#{res[:data][:affected_domains].join(', ')}"]
if res[:data][:skipped_domains]
notices << "#{t('.skipped_domains')}: #{res[:data][:skipped_domains].join(', ')}"
end
notices.join(', ')
end
def domain_list_from_csv
return [] if params[:puny_file].blank?

View file

@ -6,9 +6,9 @@ module Repp
def update
affected, errored = current_user.registrar
.replace_nameservers(hostname,
hostname_params[:data][:attributes],
domains: domains_from_params)
.replace_nameservers(hostname,
hostname_params[:data][:attributes],
domains: domains_from_params)
render_success(data: data_format_for_success(affected, errored))
rescue ActiveRecord::RecordInvalid => e