mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Merge pull request #48 from internetee/story/109623634-transfer-domain
Story/109623634 transfer domain
This commit is contained in:
commit
59a588332a
2 changed files with 12 additions and 2 deletions
|
@ -58,6 +58,11 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
before_save :manage_statuses
|
before_save :manage_statuses
|
||||||
def manage_statuses
|
def manage_statuses
|
||||||
|
if domain_transfer # very ugly but need better workflow
|
||||||
|
self.statuses = statuses | [OK, LINKED]
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
manage_linked
|
manage_linked
|
||||||
manage_ok
|
manage_ok
|
||||||
end
|
end
|
||||||
|
@ -81,6 +86,7 @@ class Contact < ActiveRecord::Base
|
||||||
]
|
]
|
||||||
|
|
||||||
attr_accessor :deliver_emails
|
attr_accessor :deliver_emails
|
||||||
|
attr_accessor :domain_transfer # hack but solves problem faster
|
||||||
|
|
||||||
#
|
#
|
||||||
# STATUSES
|
# STATUSES
|
||||||
|
|
|
@ -3,10 +3,11 @@ class Epp::Domain < Domain
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
# TODO: remove this spagetti once data in production is correct.
|
# TODO: remove this spagetti once data in production is correct.
|
||||||
attr_accessor :is_renewal
|
attr_accessor :is_renewal, :is_transfer
|
||||||
|
|
||||||
before_validation :manage_permissions
|
before_validation :manage_permissions
|
||||||
def manage_permissions
|
def manage_permissions
|
||||||
|
return true if is_transfer
|
||||||
return unless update_prohibited? || delete_prohibited?
|
return unless update_prohibited? || delete_prohibited?
|
||||||
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
||||||
false
|
false
|
||||||
|
@ -14,7 +15,7 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
after_validation :validate_contacts
|
after_validation :validate_contacts
|
||||||
def validate_contacts
|
def validate_contacts
|
||||||
return true if is_renewal
|
return true if is_renewal || is_transfer
|
||||||
|
|
||||||
ok = true
|
ok = true
|
||||||
active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? }
|
active_admins = admin_domain_contacts.select { |x| !x.marked_for_destruction? }
|
||||||
|
@ -597,6 +598,8 @@ class Epp::Domain < Domain
|
||||||
|
|
||||||
# rubocop: disable Metrics/CyclomaticComplexity
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
def transfer(frame, action, current_user)
|
def transfer(frame, action, current_user)
|
||||||
|
@is_transfer = true
|
||||||
|
|
||||||
case action
|
case action
|
||||||
when 'query'
|
when 'query'
|
||||||
return domain_transfers.last if domain_transfers.any?
|
return domain_transfers.last if domain_transfers.any?
|
||||||
|
@ -624,6 +627,7 @@ class Epp::Domain < Domain
|
||||||
oc.registrar_id = registrar_id
|
oc.registrar_id = registrar_id
|
||||||
oc.copy_from_id = c.id
|
oc.copy_from_id = c.id
|
||||||
oc.prefix_code
|
oc.prefix_code
|
||||||
|
oc.domain_transfer = true
|
||||||
oc.save!(validate: false)
|
oc.save!(validate: false)
|
||||||
oc
|
oc
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue