From b9d57be6abb90dbbac170ca676633fc0cc2b8b59 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Mon, 15 Feb 2021 19:46:16 +0500 Subject: [PATCH] Add i18n, change error response code to 2304 --- app/models/actions/contact_delete.rb | 2 +- app/models/epp/contact.rb | 4 +++- config/locales/contacts.en.yml | 2 +- test/integration/epp/contact/delete/base_test.rb | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/models/actions/contact_delete.rb b/app/models/actions/contact_delete.rb index d4169e8b3..60d3252c4 100644 --- a/app/models/actions/contact_delete.rb +++ b/app/models/actions/contact_delete.rb @@ -20,7 +20,7 @@ module Actions end if contact.delete_prohibited? - contact.errors.add(:status, :delete_prohibited) + contact.errors.add(:statuses, :delete_prohibited) return end diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index e7054c8aa..4cd876d5f 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -82,9 +82,11 @@ class Epp::Contact < Contact '2302' => [ # Object exists [:code, :epp_id_taken] ], + '2304' => [ # Status prohibits operation + [:statuses, :delete_prohibited], + ], '2305' => [ # Association exists [:domains, :exist], - [:domains, :delete_prohibited], ] } end diff --git a/config/locales/contacts.en.yml b/config/locales/contacts.en.yml index b5f0dd7ed..4b4d099d7 100644 --- a/config/locales/contacts.en.yml +++ b/config/locales/contacts.en.yml @@ -25,10 +25,10 @@ en: email_regex_check_error: Invalid format domains: exist: 'Object association prohibits operation' - status: delete_prohibited: Contact delete prohibited by status statuses: not_uniq: 'not uniq' + delete_prohibited: Contact delete prohibited by status country_code: invalid: Country code is not valid, should be in ISO_3166-1 alpha 2 format (%{value}) disclosed_attributes: diff --git a/test/integration/epp/contact/delete/base_test.rb b/test/integration/epp/contact/delete/base_test.rb index 5bdb7b8cf..e86bea9dd 100644 --- a/test/integration/epp/contact/delete/base_test.rb +++ b/test/integration/epp/contact/delete/base_test.rb @@ -51,7 +51,7 @@ class EppContactDeleteBaseTest < EppTestCase headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert Contact.exists?(id: contact.id) - assert_epp_response :object_association_prohibits_operation + assert_epp_response :object_status_prohibits_operation end def test_delete_contact_with_client_delete_prohibited @@ -78,7 +78,7 @@ class EppContactDeleteBaseTest < EppTestCase headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } assert Contact.exists?(id: contact.id) - assert_epp_response :object_association_prohibits_operation + assert_epp_response :object_status_prohibits_operation end def test_undeletable_cannot_be_deleted