mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Merge master into Story#109086524
This commit is contained in:
commit
30f9b20570
28 changed files with 453 additions and 271 deletions
|
@ -3,11 +3,12 @@ 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
|
||||
return if is_admin # this bad hack for 109086524, refactor later
|
||||
return true if is_transfer
|
||||
return unless update_prohibited? || delete_prohibited?
|
||||
add_epp_error('2304', nil, nil, I18n.t(:object_status_prohibits_operation))
|
||||
false
|
||||
|
@ -15,7 +16,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? }
|
||||
|
@ -501,10 +502,13 @@ class Epp::Domain < Domain
|
|||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
def apply_pending_update!
|
||||
old_registrant_email = DomainMailer.registrant_updated_notification_for_old_registrant(id, deliver_emails)
|
||||
preclean_pendings
|
||||
user = ApiUser.find(pending_json['current_user_id'])
|
||||
frame = Nokogiri::XML(pending_json['frame'])
|
||||
|
||||
self.deliver_emails = true # turn on email delivery
|
||||
send_mail :registrant_updated_notification_for_old_registrant
|
||||
|
||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
yield(self) if block_given? # need to skip statuses check here
|
||||
self.save
|
||||
|
@ -512,9 +516,9 @@ class Epp::Domain < Domain
|
|||
::PaperTrail.whodunnit = user.id_role_username # updator str should be the request originator not the approval user
|
||||
return unless update(frame, user, false)
|
||||
clean_pendings!
|
||||
self.deliver_emails = true # turn on email delivery
|
||||
DomainMailer.registrant_updated_notification_for_new_registrant(id, deliver_emails).deliver
|
||||
old_registrant_email.deliver
|
||||
|
||||
send_mail :registrant_updated_notification_for_new_registrant
|
||||
update_whois_record
|
||||
true
|
||||
end
|
||||
|
||||
|
@ -595,6 +599,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?
|
||||
|
@ -622,6 +628,7 @@ class Epp::Domain < Domain
|
|||
oc.registrar_id = registrar_id
|
||||
oc.copy_from_id = c.id
|
||||
oc.prefix_code
|
||||
oc.domain_transfer = true
|
||||
oc.save!(validate: false)
|
||||
oc
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue