mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Implement FD notes updating
This commit is contained in:
parent
f461388783
commit
c47b093a45
6 changed files with 83 additions and 2 deletions
|
@ -62,6 +62,7 @@ class ValidationEvent < ApplicationRecord
|
|||
if object.need_to_start_force_delete?
|
||||
start_force_delete
|
||||
elsif object.need_to_lift_force_delete?
|
||||
refresh_status_notes
|
||||
lift_force_delete
|
||||
end
|
||||
end
|
||||
|
@ -70,6 +71,23 @@ class ValidationEvent < ApplicationRecord
|
|||
Domains::ForceDeleteEmail::Base.run(email: email)
|
||||
end
|
||||
|
||||
def refresh_status_notes
|
||||
old_email = object.email_history
|
||||
domain_contacts = Contact.where(email: email).map(&:domain_contacts).flatten
|
||||
registrant_ids = Registrant.where(email: email).pluck(:id)
|
||||
|
||||
domains = domain_contacts.map(&:domain).flatten +
|
||||
Domain.where(registrant_id: registrant_ids)
|
||||
|
||||
domains.uniq.each do |domain|
|
||||
next unless domain.status_notes[DomainStatus::FORCE_DELETE]
|
||||
|
||||
domain.status_notes[DomainStatus::FORCE_DELETE].slice!(old_email)
|
||||
domain.status_notes[DomainStatus::FORCE_DELETE].lstrip!
|
||||
domain.save(validate: false)
|
||||
end
|
||||
end
|
||||
|
||||
def lift_force_delete
|
||||
# domain_contacts = Contact.where(email: email).map(&:domain_contacts).flatten
|
||||
# registrant_ids = Registrant.where(email: email).pluck(:id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue