mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 04:37:30 +02:00
Fix CC issues
This commit is contained in:
parent
451e1f79af
commit
a182dfb3ba
5 changed files with 7 additions and 6 deletions
|
@ -32,7 +32,8 @@ module Repp
|
|||
domains = params[:data][:domains] || []
|
||||
|
||||
begin
|
||||
affected_domains = current_user.registrar.replace_nameservers(hostname, new_attributes, domains)
|
||||
affected_domains = current_user.registrar.replace_nameservers(hostname, new_attributes,
|
||||
domains: domains)
|
||||
rescue ActiveRecord::RecordInvalid => e
|
||||
error!({ errors: e.record.errors.full_messages.map { |error| { title: error } } }, 400)
|
||||
end
|
||||
|
|
|
@ -8,7 +8,6 @@ class Registrar
|
|||
|
||||
domains = domain_list_from_csv
|
||||
|
||||
puts "Domains are #{domains}"
|
||||
uri = URI.parse("#{ENV['repp_url']}registrar/nameservers")
|
||||
request = Net::HTTP::Put.new(uri, 'Content-Type' => 'application/json')
|
||||
request.body = { data: { type: 'nameserver', id: params[:old_hostname],
|
||||
|
@ -61,10 +60,10 @@ class Registrar
|
|||
end
|
||||
|
||||
def domain_list_from_csv
|
||||
return [] if params[:batch_file].blank?
|
||||
return [] if params[:puny_file].blank?
|
||||
|
||||
domains = []
|
||||
CSV.read(params[:batch_file].path, headers: true).each { |b| domains << b['domain_name'] }
|
||||
CSV.read(params[:puny_file].path, headers: true).each { |b| domains << b['domain_name'] }
|
||||
domains
|
||||
end
|
||||
end
|
||||
|
|
|
@ -141,7 +141,7 @@ class Registrar < ApplicationRecord
|
|||
end
|
||||
|
||||
# Audit log is needed, therefore no raw SQL
|
||||
def replace_nameservers(hostname, new_attributes, domains)
|
||||
def replace_nameservers(hostname, new_attributes, domains: [])
|
||||
transaction do
|
||||
domain_list = []
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<%= label_tag 'List of domains' %>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<%= file_field_tag :batch_file, required: false, accept: 'text/csv' %>
|
||||
<%= file_field_tag :puny_file, required: false, accept: 'text/csv' %>
|
||||
<span class="help-block">CSV format, must have domain_name field. List of domains that nameserver change should be scoped to.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -8,6 +8,7 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
|
|||
def test_replaces_current_registrar_nameservers
|
||||
request_body = { data: { type: 'nameserver',
|
||||
id: 'ns1.bestnames.test',
|
||||
domains: [],
|
||||
attributes: { hostname: 'new-ns.bestnames.test',
|
||||
ipv4: %w[192.0.2.55 192.0.2.56],
|
||||
ipv6: %w[2001:db8::55 2001:db8::56] } } }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue