From 5de0645d41fbd1d6ee19705d61d2bda72e00546d Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Fri, 29 Jan 2021 18:00:51 +0200 Subject: [PATCH 01/14] added tests for domain locked notifications --- test/jobs/domain_update_confirm_job_test.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/jobs/domain_update_confirm_job_test.rb b/test/jobs/domain_update_confirm_job_test.rb index ded0d3d8a..51c42aa4f 100644 --- a/test/jobs/domain_update_confirm_job_test.rb +++ b/test/jobs/domain_update_confirm_job_test.rb @@ -1,5 +1,4 @@ require "test_helper" - class DomainUpdateConfirmJobTest < ActiveSupport::TestCase def setup super @@ -19,6 +18,22 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase super end + def test_registrant_locked_domain + refute @domain.locked_by_registrant? + @domain.apply_registry_lock + assert @domain.locked_by_registrant? + assert_equal(@domain.registrar.notifications.last.text, 'Domain has been locked by registrant') + end + + def test_registrant_unlocked_domain + refute @domain.locked_by_registrant? + @domain.apply_registry_lock + assert @domain.locked_by_registrant? + @domain.remove_registry_lock + refute @domain.locked_by_registrant? + assert_equal(@domain.registrar.notifications.last.text, 'Domain has been unlocked by registrant') + end + def test_rejected_registrant_verification_notifies_registrar DomainUpdateConfirmJob.perform_now(@domain.id, RegistrantVerification::REJECTED) From ac50634a00d7de60caf000bc71bebd75db224252 Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Thu, 4 Feb 2021 13:59:52 +0200 Subject: [PATCH 02/14] added tests for getting info from contact without prefix --- .../integration/epp/contact/info/base_test.rb | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/test/integration/epp/contact/info/base_test.rb b/test/integration/epp/contact/info/base_test.rb index 4e4a9190e..6b04d98a2 100644 --- a/test/integration/epp/contact/info/base_test.rb +++ b/test/integration/epp/contact/info/base_test.rb @@ -44,6 +44,56 @@ class EppContactInfoBaseTest < EppTestCase contact: xml_schema).text end + def test_get_info_about_contact_with_prefix + @contact.update_columns(code: 'TEST:JOHN-001') + + request_xml = <<-XML + + + + + + TEST:JOHN-001 + + + + + XML + + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + + response_xml = Nokogiri::XML(response.body) + assert_epp_response :completed_successfully + assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text + assert_equal '+555.555', response_xml.at_xpath('//contact:voice', contact: xml_schema).text + end + + def test_get_info_about_contact_without_prefix + @contact.update_columns(code: 'TEST:JOHN-001') + + request_xml = <<-XML + + + + + + JOHN-001 + + + + + XML + + post epp_info_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + + response_xml = Nokogiri::XML(response.body) + assert_epp_response :completed_successfully + assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text + assert_equal '+555.555', response_xml.at_xpath('//contact:voice', contact: xml_schema).text + end + def test_hides_password_and_name_when_current_registrar_is_not_sponsoring non_sponsoring_registrar = registrars(:goodnames) @contact.update!(registrar: non_sponsoring_registrar) From 8f4f2509ef607ab86d0761d40cf7a4ef199ac8a8 Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Thu, 4 Feb 2021 14:02:48 +0200 Subject: [PATCH 03/14] mend --- .ruby-version | 2 +- test/integration/epp/contact/info/base_test.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 37c2961c2..57cf282eb 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.2 +2.6.5 diff --git a/test/integration/epp/contact/info/base_test.rb b/test/integration/epp/contact/info/base_test.rb index 6b04d98a2..4b4cb017f 100644 --- a/test/integration/epp/contact/info/base_test.rb +++ b/test/integration/epp/contact/info/base_test.rb @@ -46,6 +46,7 @@ class EppContactInfoBaseTest < EppTestCase def test_get_info_about_contact_with_prefix @contact.update_columns(code: 'TEST:JOHN-001') + assert @contact.code, 'TEST:JOHN-001' request_xml = <<-XML @@ -71,6 +72,7 @@ class EppContactInfoBaseTest < EppTestCase def test_get_info_about_contact_without_prefix @contact.update_columns(code: 'TEST:JOHN-001') + assert @contact.code, 'TEST:JOHN-001' request_xml = <<-XML From 1bdfcef36b91e0fa2d9abc7daa1754d6b2571ac3 Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Thu, 4 Feb 2021 14:04:03 +0200 Subject: [PATCH 04/14] Revert "mend" This reverts commit 8f4f2509ef607ab86d0761d40cf7a4ef199ac8a8. --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 57cf282eb..37c2961c2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.5 +2.7.2 From c7b40450184f959472bd25bc1017a593eb1e7ffe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 9 Feb 2021 11:46:47 +0200 Subject: [PATCH 05/14] Contact: Append prefix unless present --- app/controllers/epp/contacts_controller.rb | 6 +++++- test/integration/epp/contact/info/base_test.rb | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index 85305213b..a0c3f503f 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -93,7 +93,11 @@ module Epp def find_contact code = params[:parsed_frame].css('id').text.strip.upcase - @contact = Epp::Contact.find_by!(code: code) + reg_code = current_user.registrar.code.upcase + arr = [code, "#{reg_code}:#{code}", "CID:#{code}", "CID:#{reg_code}:#{code}"] + + contact = arr.find { |c| Epp::Contact.find_by(code: c).present? } + @contact = Epp::Contact.find_by!(code: contact || code) end # diff --git a/test/integration/epp/contact/info/base_test.rb b/test/integration/epp/contact/info/base_test.rb index 4b4cb017f..3edb6d461 100644 --- a/test/integration/epp/contact/info/base_test.rb +++ b/test/integration/epp/contact/info/base_test.rb @@ -71,8 +71,8 @@ class EppContactInfoBaseTest < EppTestCase end def test_get_info_about_contact_without_prefix - @contact.update_columns(code: 'TEST:JOHN-001') - assert @contact.code, 'TEST:JOHN-001' + @contact.update_columns(code: "#{@contact.registrar.code}:JOHN-001".upcase) + assert @contact.code, "#{@contact.registrar.code}:JOHN-001".upcase request_xml = <<-XML @@ -92,7 +92,7 @@ class EppContactInfoBaseTest < EppTestCase response_xml = Nokogiri::XML(response.body) assert_epp_response :completed_successfully - assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text + assert_equal "#{@contact.registrar.code}:JOHN-001".upcase, response_xml.at_xpath('//contact:id', contact: xml_schema).text assert_equal '+555.555', response_xml.at_xpath('//contact:voice', contact: xml_schema).text end From aefb7e42aea9611db582d9f892cb574f46c1d31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 9 Feb 2021 16:27:15 +0200 Subject: [PATCH 06/14] Registry lock: Notify Registrar by EPP notification --- app/models/concerns/domain/registry_lockable.rb | 12 ++++++++++++ config/locales/notifications.en.yml | 2 ++ test/jobs/domain_update_confirm_job_test.rb | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/models/concerns/domain/registry_lockable.rb b/app/models/concerns/domain/registry_lockable.rb index 4a759296d..4190722f3 100644 --- a/app/models/concerns/domain/registry_lockable.rb +++ b/app/models/concerns/domain/registry_lockable.rb @@ -12,6 +12,7 @@ module Concerns statuses << DomainStatus::SERVER_DELETE_PROHIBITED statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED self.locked_by_registrant_at = Time.zone.now + alert_registrar_lock_changes! save! end @@ -42,10 +43,21 @@ module Concerns statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED) statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED) self.locked_by_registrant_at = nil + alert_registrar_lock_changes! save! end end + + def alert_registrar_lock_changes! + translation = locked_by_registrant? ? 'locked' : 'unlocked' + registrar.notifications.create!( + text: I18n.t("notifications.texts.registrar_#{translation}", + domain_name: domain.name), + attached_obj_id: name, + attached_obj_type: self.class.name + ) + end end end end diff --git a/config/locales/notifications.en.yml b/config/locales/notifications.en.yml index 1dff4a97c..d67fb5a5b 100644 --- a/config/locales/notifications.en.yml +++ b/config/locales/notifications.en.yml @@ -6,3 +6,5 @@ en: It was associated with registrant %{old_registrant_code} and contacts %{old_contacts_codes}. contact_update: Contact %{contact} has been updated by registrant + registrar_locked: Domain %{domain_name} has been locked by registrant + registrar_unlocked: Domain %{domain_name} has been unlocked by registrant diff --git a/test/jobs/domain_update_confirm_job_test.rb b/test/jobs/domain_update_confirm_job_test.rb index 51c42aa4f..dc6e14bf9 100644 --- a/test/jobs/domain_update_confirm_job_test.rb +++ b/test/jobs/domain_update_confirm_job_test.rb @@ -18,11 +18,11 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase super end - def test_registrant_locked_domain + def test_registrant_locked_domain refute @domain.locked_by_registrant? @domain.apply_registry_lock assert @domain.locked_by_registrant? - assert_equal(@domain.registrar.notifications.last.text, 'Domain has been locked by registrant') + assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been unlocked by registrant") end def test_registrant_unlocked_domain @@ -31,7 +31,7 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase assert @domain.locked_by_registrant? @domain.remove_registry_lock refute @domain.locked_by_registrant? - assert_equal(@domain.registrar.notifications.last.text, 'Domain has been unlocked by registrant') + assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been unlocked by registrant") end def test_rejected_registrant_verification_notifies_registrar From 66dfa730ec1c8f3a00d94c51b37d3088f71a5ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Tue, 9 Feb 2021 16:27:15 +0200 Subject: [PATCH 07/14] Registry lock: Notify Registrar by EPP notification --- app/models/concerns/domain/registry_lockable.rb | 12 ++++++++++++ config/locales/notifications.en.yml | 2 ++ test/jobs/domain_update_confirm_job_test.rb | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/models/concerns/domain/registry_lockable.rb b/app/models/concerns/domain/registry_lockable.rb index 4a759296d..ccb0f305e 100644 --- a/app/models/concerns/domain/registry_lockable.rb +++ b/app/models/concerns/domain/registry_lockable.rb @@ -12,6 +12,7 @@ module Concerns statuses << DomainStatus::SERVER_DELETE_PROHIBITED statuses << DomainStatus::SERVER_TRANSFER_PROHIBITED self.locked_by_registrant_at = Time.zone.now + alert_registrar_lock_changes! save! end @@ -42,10 +43,21 @@ module Concerns statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED) statuses.delete(DomainStatus::SERVER_TRANSFER_PROHIBITED) self.locked_by_registrant_at = nil + alert_registrar_lock_changes! save! end end + + def alert_registrar_lock_changes! + translation = locked_by_registrant? ? 'locked' : 'unlocked' + registrar.notifications.create!( + text: I18n.t("notifications.texts.registrar_#{translation}", + domain_name: name), + attached_obj_id: name, + attached_obj_type: self.class.name + ) + end end end end diff --git a/config/locales/notifications.en.yml b/config/locales/notifications.en.yml index 1dff4a97c..d67fb5a5b 100644 --- a/config/locales/notifications.en.yml +++ b/config/locales/notifications.en.yml @@ -6,3 +6,5 @@ en: It was associated with registrant %{old_registrant_code} and contacts %{old_contacts_codes}. contact_update: Contact %{contact} has been updated by registrant + registrar_locked: Domain %{domain_name} has been locked by registrant + registrar_unlocked: Domain %{domain_name} has been unlocked by registrant diff --git a/test/jobs/domain_update_confirm_job_test.rb b/test/jobs/domain_update_confirm_job_test.rb index 51c42aa4f..dc6e14bf9 100644 --- a/test/jobs/domain_update_confirm_job_test.rb +++ b/test/jobs/domain_update_confirm_job_test.rb @@ -18,11 +18,11 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase super end - def test_registrant_locked_domain + def test_registrant_locked_domain refute @domain.locked_by_registrant? @domain.apply_registry_lock assert @domain.locked_by_registrant? - assert_equal(@domain.registrar.notifications.last.text, 'Domain has been locked by registrant') + assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been unlocked by registrant") end def test_registrant_unlocked_domain @@ -31,7 +31,7 @@ class DomainUpdateConfirmJobTest < ActiveSupport::TestCase assert @domain.locked_by_registrant? @domain.remove_registry_lock refute @domain.locked_by_registrant? - assert_equal(@domain.registrar.notifications.last.text, 'Domain has been unlocked by registrant') + assert_equal(@domain.registrar.notifications.last.text, "Domain #{@domain.name} has been unlocked by registrant") end def test_rejected_registrant_verification_notifies_registrar From 43ff03e6e147c65620363d8c6356f15879c1f4fd Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Wed, 10 Feb 2021 10:42:59 +0200 Subject: [PATCH 08/14] added test for check --- .../epp/contact/check/base_test.rb | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/test/integration/epp/contact/check/base_test.rb b/test/integration/epp/contact/check/base_test.rb index 528d69d86..3fc9f64ac 100644 --- a/test/integration/epp/contact/check/base_test.rb +++ b/test/integration/epp/contact/check/base_test.rb @@ -98,6 +98,58 @@ class EppContactCheckBaseTest < EppTestCase assert_equal 3, response_xml.xpath('//contact:cd', contact: xml_schema).size end + def test_check_contact_with_prefix + @contact.update_columns(code: 'TEST:JOHN-001') + assert @contact.code, 'TEST:JOHN-001' + + request_xml = <<-XML + + + + + + TEST:JOHN-001 + + + + + XML + + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + + response_xml = Nokogiri::XML(response.body) + assert_epp_response :completed_successfully + assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text + assert_equal 'in use', response_xml.at_xpath('//contact:reason', contact: xml_schema).text + end + + def test_check_contact_without_prefix + @contact.update_columns(code: "#{@contact.registrar.code}:JOHN-001".upcase) + assert @contact.code, "#{@contact.registrar.code}:JOHN-001".upcase + + request_xml = <<-XML + + + + + + JOHN-001 + + + + + XML + + post epp_check_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + + response_xml = Nokogiri::XML(response.body) + assert_epp_response :completed_successfully + assert_equal 'TEST:JOHN-001', response_xml.at_xpath('//contact:id', contact: xml_schema).text + assert_equal 'in use', response_xml.at_xpath('//contact:reason', contact: xml_schema).text + end + private def xml_schema From 0617ef9d7d3e82b3785fcf0520a4149a165a51e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 10 Feb 2021 12:03:22 +0200 Subject: [PATCH 09/14] Fix contact code check --- app/controllers/epp/contacts_controller.rb | 2 +- app/models/epp/contact.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/epp/contacts_controller.rb b/app/controllers/epp/contacts_controller.rb index a0c3f503f..65354ff48 100644 --- a/app/controllers/epp/contacts_controller.rb +++ b/app/controllers/epp/contacts_controller.rb @@ -14,7 +14,7 @@ module Epp authorize! :check, Epp::Contact ids = params[:parsed_frame].css('id').map(&:text) - @results = Epp::Contact.check_availability(ids) + @results = Epp::Contact.check_availability(ids, reg: current_user.registrar.code) render_epp_response '/epp/contacts/check' end diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 50ebac065..edc828f81 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -42,8 +42,9 @@ class Epp::Contact < Contact ) end - def check_availability(codes) + def check_availability(codes, reg:) codes = [codes] if codes.is_a?(String) + codes = codes.map { |c| c.include?(':') ? c : "#{reg}:#{c}" } res = [] codes.each do |x| From 7638bff5466fd74f5fc80f48493c82fc96b67230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Wed, 10 Feb 2021 16:36:57 +0200 Subject: [PATCH 10/14] Add registry lock operation to epp notification --- app/models/notification.rb | 4 ++++ app/views/epp/poll/poll_req.xml.builder | 22 ++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/models/notification.rb b/app/models/notification.rb index e83b2c9da..07e824367 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -25,6 +25,10 @@ class Notification < ApplicationRecord '' end + def registry_lock? + text.include?('has been locked') || text.include?('has been unlocked') + end + private def set_defaults diff --git a/app/views/epp/poll/poll_req.xml.builder b/app/views/epp/poll/poll_req.xml.builder index 664327dae..a58b082c5 100644 --- a/app/views/epp/poll/poll_req.xml.builder +++ b/app/views/epp/poll/poll_req.xml.builder @@ -15,12 +15,22 @@ xml.epp_head do end if @object end - if @notification.action&.contact - render(partial: 'epp/poll/action', - locals: { - builder: xml, - action: @notification.action - }) + if @notification.action&.contact || @notification.registry_lock? + if @notification.registry_lock? + state = @notification.text.include?('unlocked') ? 'unlock' : 'lock' + xml.extension do + xml.tag!('changePoll:changeData', + 'xmlns:changePoll': 'https://epp.tld.ee/schema/changePoll-1.0.xsd') do + xml.tag!('changePoll:operation', state) + end + end + else + render(partial: 'epp/poll/action', + locals: { + builder: xml, + action: @notification.action, + }) + end end render('epp/shared/trID', builder: xml) From b2e489630d9effe967a8ebb88d5bd0ab556c2015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 11 Feb 2021 13:15:47 +0200 Subject: [PATCH 11/14] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f6065826..b935ae6e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +11.02.2021 +* Poll messages on locking and unlocking a domain [#1828](https://github.com/internetee/registry/issues/1828) + 10.02.2021 * Admin contact bulk change option for registrars [#1764](https://github.com/internetee/registry/issues/1764) * Option to remove email addresses from AWS SES Supression list [#1839](https://github.com/internetee/registry/issues/1839) From 8dfe1c83e6da53d7fe1d8577120ad2ad188ea4a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 11 Feb 2021 14:06:51 +0200 Subject: [PATCH 12/14] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b935ae6e4..9afedbf17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ 11.02.2021 * Poll messages on locking and unlocking a domain [#1828](https://github.com/internetee/registry/issues/1828) +* Registrar's prefix is now checked and added to contact id for info and check requests [#1832](https://github.com/internetee/registry/issues/1832) 10.02.2021 * Admin contact bulk change option for registrars [#1764](https://github.com/internetee/registry/issues/1764) From ac726a955495d917abe13b61a0b067260e0d657a Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 11 Feb 2021 19:58:02 +0500 Subject: [PATCH 13/14] Add admin_contact bulk update endpoint documentation --- doc/repp/v1/admin_contacts.md | 30 ++++++++++++++++++++++++++++++ doc/repp/v1/domain_contacts.md | 4 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 doc/repp/v1/admin_contacts.md diff --git a/doc/repp/v1/admin_contacts.md b/doc/repp/v1/admin_contacts.md new file mode 100644 index 000000000..3b78829d0 --- /dev/null +++ b/doc/repp/v1/admin_contacts.md @@ -0,0 +1,30 @@ +# Admin domain contacts + +## PATCH https://repp.internet.ee/v1/domains/admin_contacts +Replaces admin domain contacts of the current registrar. + +### Example request +``` +PATCH /repp/v1/domains/admin_contacts HTTP/1.1 +Accept: application/json +Content-Type: application/json +Authorization: Basic dGVzdDp0ZXN0dGVzdA== + +{ + "current_contact_id": "ATSAA:749AA80F", + "new_contact_id": "ATSAA:E36957D7" +} +``` +### Example response +``` +{ + "code": 1000, + "message": "Command completed successfully", + "data": { + "affected_domains": [ + "private.ee", + ], + "skipped_domains": [] + } +} +``` diff --git a/doc/repp/v1/domain_contacts.md b/doc/repp/v1/domain_contacts.md index 2e542bf81..8c3c9b9de 100644 --- a/doc/repp/v1/domain_contacts.md +++ b/doc/repp/v1/domain_contacts.md @@ -1,7 +1,7 @@ -# Domain contacts +# Tech domain contacts ## PATCH https://repp.internet.ee/v1/domains/contacts -Replaces all domain contacts of the current registrar. +Replaces technical domain contacts of the current registrar. ### Example request ``` From 06ae9b8e2447df2ce286779256eeb96dbf40b960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 12 Feb 2021 13:01:28 +0200 Subject: [PATCH 14/14] Optimize WHOIS record destroy SQL check --- app/models/whois_record.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb index 19805d583..9a6229fcb 100644 --- a/app/models/whois_record.rb +++ b/app/models/whois_record.rb @@ -97,7 +97,9 @@ class WhoisRecord < ApplicationRecord end def destroy_whois_record - Whois::Record.without_auctions.where(name: name).delete_all + return if Auction.find_by(domain: name).present? + + Whois::Record.where(name: name).delete_all end private