From 4980bc591db45ff80e07a245a44fe73c0c9d1e9e Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 7 Dec 2015 17:15:23 +0200 Subject: [PATCH 1/5] Story#109623634 - No after-validate contacts callback for transfer --- app/models/epp/domain.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 739c55bec..0ec24c60b 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -3,7 +3,7 @@ class Epp::Domain < Domain include EppErrors # TODO: remove this spagetti once data in production is correct. - attr_accessor :is_renewal + attr_accessor :is_renewal, :is_transfer before_validation :manage_permissions def manage_permissions @@ -14,7 +14,7 @@ class Epp::Domain < Domain after_validation :validate_contacts def validate_contacts - return true if is_renewal + return true if is_renewal || is_transfer ok = true active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? } @@ -592,6 +592,8 @@ class Epp::Domain < Domain # rubocop: disable Metrics/CyclomaticComplexity def transfer(frame, action, current_user) + @is_transfer = true + case action when 'query' return domain_transfers.last if domain_transfers.any? From 668cbdac06d6fcdf549dd05191eb5fb2df27c515 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Mon, 7 Dec 2015 17:25:24 +0200 Subject: [PATCH 2/5] Story#109623634 - No after-validate contacts callback for transfer --- app/models/epp/domain.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 0ec24c60b..7ab57781e 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -7,6 +7,7 @@ class Epp::Domain < Domain before_validation :manage_permissions def manage_permissions + return true if is_transfer return unless update_prohibited? || delete_prohibited? add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation)) false From 9027f5007c14134067dad7ffe61a74498138851a Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 18 Dec 2015 14:00:41 +0200 Subject: [PATCH 3/5] Story#109623634 - after contact transferring new one should have state linked --- app/models/epp/domain.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 7ab57781e..26f0c3153 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -622,6 +622,7 @@ class Epp::Domain < Domain oc.registrar_id = registrar_id oc.copy_from_id = c.id oc.prefix_code + oc.domains_present = true oc.save!(validate: false) oc end From e4c00e6bcee25144c726ea3fe3ce7fdbb1245da5 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 18 Dec 2015 15:48:00 +0200 Subject: [PATCH 4/5] Story#109623634 - after contact transferring it should be linked and ok --- app/models/contact.rb | 6 ++++++ app/models/epp/domain.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index fcebe8632..bcd359ca9 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -57,6 +57,11 @@ class Contact < ActiveRecord::Base before_save :manage_statuses def manage_statuses + if domain_transfer # very ugly but need better workflow + self.statuses = [OK, LINKED] + return + end + manage_linked manage_ok end @@ -78,6 +83,7 @@ class Contact < ActiveRecord::Base ] attr_accessor :deliver_emails + attr_accessor :domain_transfer # hack but solves problem faster # # STATUSES diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb index 26f0c3153..fac09705d 100644 --- a/app/models/epp/domain.rb +++ b/app/models/epp/domain.rb @@ -622,7 +622,7 @@ class Epp::Domain < Domain oc.registrar_id = registrar_id oc.copy_from_id = c.id oc.prefix_code - oc.domains_present = true + oc.domain_transfer = true oc.save!(validate: false) oc end From fd186901a483dd659e92f9a2dd60277146889082 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 18 Dec 2015 16:45:13 +0200 Subject: [PATCH 5/5] Story#109623634 - save old states. --- 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 bcd359ca9..2375090da 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -58,7 +58,7 @@ class Contact < ActiveRecord::Base before_save :manage_statuses def manage_statuses if domain_transfer # very ugly but need better workflow - self.statuses = [OK, LINKED] + self.statuses = statuses | [OK, LINKED] return end