diff --git a/app/controllers/registrar/nameservers_controller.rb b/app/controllers/registrar/nameservers_controller.rb
index c8c88c8ca..2a22476be 100644
--- a/app/controllers/registrar/nameservers_controller.rb
+++ b/app/controllers/registrar/nameservers_controller.rb
@@ -49,12 +49,13 @@ class Registrar
if response.code == '200'
notices = [t('.replaced')]
- notices << "#{t('.affected_domains')}: #{parsed_response[:affected_domains].join(', ')}"
+ notices << "#{t('.affected_domains')}: " \
+ "#{parsed_response[:data][:affected_domains].join(', ')}"
- flash[:notice] = notices
+ flash[:notice] = notices.join(', ')
redirect_to registrar_domains_url
else
- @api_errors = parsed_response[:errors]
+ @api_errors = parsed_response[:message]
render file: 'registrar/bulk_change/new', locals: { active_tab: :nameserver }
end
end
diff --git a/app/views/registrar/bulk_change/_api_errors.html.erb b/app/views/registrar/bulk_change/_api_errors.html.erb
index 56bf8c404..8d8862959 100644
--- a/app/views/registrar/bulk_change/_api_errors.html.erb
+++ b/app/views/registrar/bulk_change/_api_errors.html.erb
@@ -1,9 +1,13 @@
<% if @api_errors %>
+ <% if @api_errors.is_a?(String) %>
+ - <%= @api_errors %>
+ <% else %>
<% @api_errors.each do |error| %>
- <%= error[:title] %>
<% end %>
+ <% end %>
<% end %>
diff --git a/app/views/registrar/domain_transfers/form/_api_errors.html.erb b/app/views/registrar/domain_transfers/form/_api_errors.html.erb
index 56bf8c404..8d8862959 100644
--- a/app/views/registrar/domain_transfers/form/_api_errors.html.erb
+++ b/app/views/registrar/domain_transfers/form/_api_errors.html.erb
@@ -1,9 +1,13 @@
<% if @api_errors %>
+ <% if @api_errors.is_a?(String) %>
+ - <%= @api_errors %>
+ <% else %>
<% @api_errors.each do |error| %>
- <%= error[:title] %>
<% end %>
+ <% end %>
<% end %>
diff --git a/test/system/registrar_area/bulk_change/nameserver_test.rb b/test/system/registrar_area/bulk_change/nameserver_test.rb
index 3d4b4dc70..48806df7a 100644
--- a/test/system/registrar_area/bulk_change/nameserver_test.rb
+++ b/test/system/registrar_area/bulk_change/nameserver_test.rb
@@ -15,10 +15,12 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
request_stub = stub_request(:put, /registrar\/nameservers/).with(body: request_body,
headers: { 'Content-type' => Mime[:json] },
basic_auth: ['test_goodnames', 'testtest'])
- .to_return(body: { data: [{
- type: 'nameserver',
- id: 'new-ns.bestnames.test'}],
- affected_domains: ["airport.test", "shop.test"]}.to_json, status: 200)
+ .to_return(body: { data: {
+ type: 'nameserver',
+ id: 'new-ns.bestnames.test',
+ affected_domains: ["airport.test", "shop.test"]
+ }
+ }.to_json, status: 200)
visit registrar_domains_url
click_link 'Bulk change'
@@ -38,7 +40,7 @@ class RegistrarAreaNameserverBulkChangeTest < ApplicationSystemTestCase
def test_fails_gracefully
stub_request(:put, /registrar\/nameservers/).to_return(status: 400,
- body: { errors: [{ title: 'epic fail' }] }.to_json,
+ body: { message: 'epic fail' }.to_json,
headers: { 'Content-type' => Mime[:json] })
visit registrar_domains_url