From 2a81b66d61eac9375dd49d3200e1a92043d42dc9 Mon Sep 17 00:00:00 2001 From: dinsmol Date: Wed, 7 Jul 2021 09:47:42 +0300 Subject: [PATCH 01/16] fix contacts name validation --- app/models/contact.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/contact.rb b/app/models/contact.rb index b6b1e979b..eae846313 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -29,6 +29,7 @@ class Contact < ApplicationRecord } validates :name, :email, presence: true + validates :name, format: { with: /\A[a-zA-Z\s]+\Z/, message: :invalid } validates :street, :city, :zip, :country_code, presence: true, if: lambda { self.class.address_processing? } From 9c6527d6d3ffbfd7a16fd141909afb5809568495 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 7 Jul 2021 15:38:08 +0500 Subject: [PATCH 02/16] Mask orphan notification as read --- app/controllers/epp/polls_controller.rb | 1 + test/integration/epp/poll_test.rb | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/app/controllers/epp/polls_controller.rb b/app/controllers/epp/polls_controller.rb index 86218336b..01cb719c4 100644 --- a/app/controllers/epp/polls_controller.rb +++ b/app/controllers/epp/polls_controller.rb @@ -27,6 +27,7 @@ module Epp Rails.logger.error 'orphan message, error ignored: ' + problem.to_s # now we should dequeue or delete the messages avoid duplicate log alarms + @notification.mark_as_read end end diff --git a/test/integration/epp/poll_test.rb b/test/integration/epp/poll_test.rb index 5cdb7e524..e3fbb0daf 100644 --- a/test/integration/epp/poll_test.rb +++ b/test/integration/epp/poll_test.rb @@ -26,6 +26,31 @@ class EppPollTest < EppTestCase assert_equal 'Your domain has been updated', xml_doc.at_css('msgQ msg').text end + def test_clears_orphan_messages_if_any + # To check if we are clearing orphan messages we need to create a message not linked to any + # existing Epp::Domain + + orphan_notification = @notification.dup + orphan_notification.attached_obj_type = Epp::Domain + orphan_notification.attached_obj_id = rand(Epp::Domain.first.id-1) + orphan_notification.save! + assert orphan_notification.unread? + + request_xml = <<-XML + + + + + + + XML + post epp_poll_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + + orphan_notification.reload + refute orphan_notification.unread? + end + def test_does_not_drop_error_if_old_version version = Version::DomainVersion.last @notification.update(attached_obj_type: 'DomainVersion', attached_obj_id: version.id) From 86c7496addc3c4313903952a985726276b7ba728 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Wed, 7 Jul 2021 17:52:26 +0500 Subject: [PATCH 03/16] Fix empty statuses_before_force_delete error --- .../restore_statuses_before_force_delete.rb | 2 +- .../epp/domain/update/base_test.rb | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/app/interactions/domains/cancel_force_delete/restore_statuses_before_force_delete.rb b/app/interactions/domains/cancel_force_delete/restore_statuses_before_force_delete.rb index c55c06764..792b63a86 100644 --- a/app/interactions/domains/cancel_force_delete/restore_statuses_before_force_delete.rb +++ b/app/interactions/domains/cancel_force_delete/restore_statuses_before_force_delete.rb @@ -2,7 +2,7 @@ module Domains module CancelForceDelete class RestoreStatusesBeforeForceDelete < Base def execute - domain.statuses = domain.statuses_before_force_delete + domain.statuses = domain.statuses_before_force_delete || [] domain.statuses_before_force_delete = nil domain.save(validate: false) end diff --git a/test/integration/epp/domain/update/base_test.rb b/test/integration/epp/domain/update/base_test.rb index 644619644..bff325307 100644 --- a/test/integration/epp/domain/update/base_test.rb +++ b/test/integration/epp/domain/update/base_test.rb @@ -588,6 +588,50 @@ class EppDomainUpdateBaseTest < EppTestCase assert_no_emails end + def test_makes_update_if_was_forcedelete + contact = @domain.contacts.first + contact.update_attribute(:email, '`@outlook.test') + contact.email_verification.verify + assert contact.email_verification_failed? + @domain.reload + assert @domain.force_delete_scheduled? + + @domain.update_attribute(:statuses_before_force_delete, nil) + + Setting.request_confirmation_on_registrant_change_enabled = true + new_registrant = contacts(:william).becomes(Registrant) + assert_not_equal new_registrant, @domain.registrant + + request_xml = <<-XML + + + + + + #{@domain.name} + + #{new_registrant.code} + + + + + + #{'test' * 2000} + + + + + XML + + post epp_update_path, params: { frame: request_xml }, + headers: { 'HTTP_COOKIE' => 'session=api_bestnames' } + @domain.reload + + response_xml = Nokogiri::XML(response.body) + assert_correct_against_schema response_xml + assert_epp_response :completed_successfully + end + def test_clears_force_delete_when_registrar_changed Setting.request_confirmation_on_registrant_change_enabled = true new_registrant = contacts(:william).becomes(Registrant) From d97f9ab720beacc9d451b4286d0ae25a2dd7b15b Mon Sep 17 00:00:00 2001 From: dinsmol Date: Wed, 7 Jul 2021 18:01:48 +0300 Subject: [PATCH 04/16] created black list of symbols --- app/models/contact.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index eae846313..8f35efb06 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -29,7 +29,11 @@ class Contact < ApplicationRecord } validates :name, :email, presence: true - validates :name, format: { with: /\A[a-zA-Z\s]+\Z/, message: :invalid } + + NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]| + [\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x + validates :name, format: { without: NAME_REGEXP, message: :invalid } + validates :street, :city, :zip, :country_code, presence: true, if: lambda { self.class.address_processing? } From 7bac37f735df67fc0602a42d9dc11179144bcb30 Mon Sep 17 00:00:00 2001 From: dinsmol Date: Wed, 7 Jul 2021 23:31:16 +0300 Subject: [PATCH 05/16] minor fixes --- app/models/contact.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 8f35efb06..5bfc1ae00 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -28,10 +28,10 @@ class Contact < ApplicationRecord .where('success = false and verified_at IS NOT NULL') } - validates :name, :email, presence: true - NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]| [\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x + + validates :name, :email, presence: true validates :name, format: { without: NAME_REGEXP, message: :invalid } validates :street, :city, :zip, :country_code, presence: true, if: lambda { From 3ed02966e8283e7e242ba57950c8569ef558948d Mon Sep 17 00:00:00 2001 From: dinsmol Date: Thu, 8 Jul 2021 00:19:18 +0300 Subject: [PATCH 06/16] added test for contact name --- test/models/contact_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/models/contact_test.rb b/test/models/contact_test.rb index 4a598b0c7..189a85dc7 100644 --- a/test/models/contact_test.rb +++ b/test/models/contact_test.rb @@ -32,6 +32,16 @@ class ContactTest < ActiveJob::TestCase assert contact.invalid? end + def test_allowed_and_disallowed_symbols_for_name + contact = valid_contact + contact.name = 'MARY ÄNN O’CONNEŽ-ŠUSLIK' + assert contact.valid? + contact.name = 'Boğaçhan Çağlayan' + assert contact.valid? + contact.name = '# "¤ #" ¤ "?' + assert contact.invalid? + end + def test_validates_code_format contact = valid_contact.dup max_length = 100 From f927ee1cf75e95fb2afb98401e2b5e95b9d171b1 Mon Sep 17 00:00:00 2001 From: dinsmol Date: Thu, 8 Jul 2021 09:30:53 +0300 Subject: [PATCH 07/16] freezed name_regexp --- app/models/contact.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 5bfc1ae00..01a4bab3d 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -29,7 +29,7 @@ class Contact < ApplicationRecord } NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]| - [\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x + [\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x.freeze validates :name, :email, presence: true validates :name, format: { without: NAME_REGEXP, message: :invalid } From d750ca2403c4a1f1fc883e6797e557beabe9d663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 8 Jul 2021 16:31:15 +0300 Subject: [PATCH 08/16] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24ffb7787..9076a1434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +08.07.2021 +* improved contact name validation [#1795](https://github.com/internetee/registry/issues/1795) + 06.07.2021 * admin dropdown filter ui fix [#2065](https://github.com/internetee/registry/issues/2065) * Bump truemail to 2.4.4 [#2071](https://github.com/internetee/registry/pull/2071) From 7877534589caba29b735739519f3dc2a540dcb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 8 Jul 2021 17:01:08 +0300 Subject: [PATCH 09/16] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9076a1434..b20121a0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ 08.07.2021 * improved contact name validation [#1795](https://github.com/internetee/registry/issues/1795) +* orphaned poll messages are automatically dequed [#2026](https://github.com/internetee/registry/issues/2026) 06.07.2021 * admin dropdown filter ui fix [#2065](https://github.com/internetee/registry/issues/2065) From b0df8f230eb28f31842a12aaf5d4c1528e461840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Thu, 8 Jul 2021 19:43:47 +0300 Subject: [PATCH 10/16] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b20121a0a..9711c3ed1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ 08.07.2021 * improved contact name validation [#1795](https://github.com/internetee/registry/issues/1795) * orphaned poll messages are automatically dequed [#2026](https://github.com/internetee/registry/issues/2026) +* fixed registrant change with force delete set [#2077](https://github.com/internetee/registry/issues/2077) 06.07.2021 * admin dropdown filter ui fix [#2065](https://github.com/internetee/registry/issues/2065) From 46479dc31be1a21f21dbd542f6e08d1692ed04cc Mon Sep 17 00:00:00 2001 From: Keijo Raamat Date: Mon, 12 Jul 2021 19:22:17 +0300 Subject: [PATCH 11/16] Revert "Merge pull request #2074 from internetee/1795-validation-contacts-name" This reverts commit e2116a505ed64511df074ddc4ed7c64ec3416745, reversing changes made to ded22685c9ff15a7f7c88b77cd32ddbda6891996. --- app/models/contact.rb | 5 ----- test/models/contact_test.rb | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index 01a4bab3d..b6b1e979b 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -28,12 +28,7 @@ class Contact < ApplicationRecord .where('success = false and verified_at IS NOT NULL') } - NAME_REGEXP = /([\u00A1-\u00B3\u00B5-\u00BF\u0021-\u0026\u0028-\u002C\u003A-\u0040]| - [\u005B-\u005F\u007B-\u007E\u2040-\u206F\u20A0-\u20BF\u2100-\u218F])/x.freeze - validates :name, :email, presence: true - validates :name, format: { without: NAME_REGEXP, message: :invalid } - validates :street, :city, :zip, :country_code, presence: true, if: lambda { self.class.address_processing? } diff --git a/test/models/contact_test.rb b/test/models/contact_test.rb index 189a85dc7..4a598b0c7 100644 --- a/test/models/contact_test.rb +++ b/test/models/contact_test.rb @@ -32,16 +32,6 @@ class ContactTest < ActiveJob::TestCase assert contact.invalid? end - def test_allowed_and_disallowed_symbols_for_name - contact = valid_contact - contact.name = 'MARY ÄNN O’CONNEŽ-ŠUSLIK' - assert contact.valid? - contact.name = 'Boğaçhan Çağlayan' - assert contact.valid? - contact.name = '# "¤ #" ¤ "?' - assert contact.invalid? - end - def test_validates_code_format contact = valid_contact.dup max_length = 100 From 89b2c88f5e49a9df708bf6ac4682956af24840f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 17:17:12 +0000 Subject: [PATCH 12/16] Bump addressable from 2.7.0 to 2.8.0 Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.7.0 to 2.8.0. - [Release notes](https://github.com/sporkmonger/addressable/releases) - [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md) - [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.7.0...addressable-2.8.0) --- updated-dependencies: - dependency-name: addressable dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 68ab07153..c2c4d7a6f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -139,7 +139,7 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.7.0) + addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) aes_key_wrap (1.1.0) airbrake (11.0.3) From d8f7f9ca16618636022bef1e54731ae1b71a7f8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 19:00:42 +0000 Subject: [PATCH 13/16] Bump data_migrate from 7.0.1 to 7.0.2 Bumps [data_migrate](https://github.com/ajvargo/data-migrate) from 7.0.1 to 7.0.2. - [Release notes](https://github.com/ajvargo/data-migrate/releases) - [Changelog](https://github.com/ilyakatz/data-migrate/blob/master/Changelog.md) - [Commits](https://github.com/ajvargo/data-migrate/commits) --- updated-dependencies: - dependency-name: data_migrate dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 68ab07153..7c7b267a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -205,7 +205,7 @@ GEM daemons-rails (1.2.1) daemons multi_json (~> 1.0) - data_migrate (7.0.1) + data_migrate (7.0.2) activerecord (>= 5.0) railties (>= 5.0) database_cleaner (2.0.1) @@ -387,7 +387,7 @@ GEM method_source rake (>= 0.13) thor (~> 1.0) - rake (13.0.3) + rake (13.0.6) ransack (2.4.2) activerecord (>= 5.2.4) activesupport (>= 5.2.4) From 19f43f65e00f9ef60bfaaa6091b4e0a26cd0e5f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 19:00:58 +0000 Subject: [PATCH 14/16] Bump active_interaction from 4.0.4 to 4.0.5 Bumps [active_interaction](https://github.com/AaronLasseigne/active_interaction) from 4.0.4 to 4.0.5. - [Release notes](https://github.com/AaronLasseigne/active_interaction/releases) - [Changelog](https://github.com/AaronLasseigne/active_interaction/blob/master/CHANGELOG.md) - [Commits](https://github.com/AaronLasseigne/active_interaction/compare/v4.0.4...v4.0.5) --- updated-dependencies: - dependency-name: active_interaction dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 68ab07153..e293b4a30 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -115,7 +115,7 @@ GEM erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - active_interaction (4.0.4) + active_interaction (4.0.5) activemodel (>= 5, < 7) activesupport (>= 5, < 7) activejob (6.1.4) From c92237bf0fa9f11eadd91ad7c0a7edfd5c3a78f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 19:01:37 +0000 Subject: [PATCH 15/16] Bump truemail from 2.4.4 to 2.4.6 Bumps [truemail](https://github.com/truemail-rb/truemail) from 2.4.4 to 2.4.6. - [Release notes](https://github.com/truemail-rb/truemail/releases) - [Changelog](https://github.com/truemail-rb/truemail/blob/master/CHANGELOG.md) - [Commits](https://github.com/truemail-rb/truemail/compare/v2.4.4...v2.4.6) --- updated-dependencies: - dependency-name: truemail dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 68ab07153..7e93742e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -463,7 +463,7 @@ GEM temple (0.8.2) thor (1.1.0) tilt (2.0.10) - truemail (2.4.4) + truemail (2.4.6) simpleidn (~> 0.2.1) tzinfo (2.0.4) concurrent-ruby (~> 1.0) From 465610b1dd526b3e191452c3b31eba69b56d8ed0 Mon Sep 17 00:00:00 2001 From: Oleg Hasjanov Date: Tue, 13 Jul 2021 14:06:39 +0300 Subject: [PATCH 16/16] updated epp request object --- app/views/admin/epp_logs/index.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/epp_logs/index.haml b/app/views/admin/epp_logs/index.haml index 29493d3f7..33ba4f96f 100644 --- a/app/views/admin/epp_logs/index.haml +++ b/app/views/admin/epp_logs/index.haml @@ -14,7 +14,7 @@ - opts = [[t(:choose),''], 'contact', 'domain', 'poll'] - opts += [params[:q][:request_object_cont]] if params[:q].present? && params[:q][:request_object_cont].present? = f.label :request_object - = f.select :request_object_cont, opts, {}, class: 'form-control js-combobox', placeholder: t(:choose) + = f.select :request_object_cont, opts, {}, class: 'form-control selectize_create', placeholder: t(:choose) .col-md-3 .form-group = f.label :request_successful