diff --git a/app/controllers/registrar/domain_transfers_controller.rb b/app/controllers/registrar/domain_transfers_controller.rb index 7205f246c..65127155e 100644 --- a/app/controllers/registrar/domain_transfers_controller.rb +++ b/app/controllers/registrar/domain_transfers_controller.rb @@ -51,11 +51,13 @@ class Registrar end end + parsed_response = JSON.parse(response.body, symbolize_names: true) + if response.code == '200' - flash[:notice] = t '.transferred' + flash[:notice] = t '.transferred', count: parsed_response[:data].size redirect_to registrar_domains_url else - @api_errors = JSON.parse(response.body, symbolize_names: true)[:errors] + @api_errors = parsed_response[:errors] render :new end else diff --git a/config/locales/registrar/domain_transfers.en.yml b/config/locales/registrar/domain_transfers.en.yml index 64663b558..d162110ce 100644 --- a/config/locales/registrar/domain_transfers.en.yml +++ b/config/locales/registrar/domain_transfers.en.yml @@ -8,7 +8,7 @@ en: create: header: Domain transfer - transferred: Domains have been successfully transferred + transferred: "%{count} domains have been successfully transferred" form: single: diff --git a/test/integration/registrar/domain_transfers_test.rb b/test/integration/registrar/domain_transfers_test.rb index c54790bb2..e29a11070 100644 --- a/test/integration/registrar/domain_transfers_test.rb +++ b/test/integration/registrar/domain_transfers_test.rb @@ -25,7 +25,7 @@ class RegistrarDomainTransfersTest < ActionDispatch::IntegrationTest assert_requested request_stub assert_current_path registrar_domains_path - assert_text 'Domains have been successfully transferred' + assert_text '1 domains have been successfully transferred' end def test_batch_transfer_fails_gracefully