mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 15:34:41 +02:00
Implement FD notes updating
This commit is contained in:
parent
f461388783
commit
c47b093a45
6 changed files with 83 additions and 2 deletions
|
@ -84,6 +84,7 @@ module Actions
|
|||
return false if @error
|
||||
|
||||
contact.generate_code
|
||||
contact.email_history = contact.email
|
||||
contact.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -112,6 +112,7 @@ module Actions
|
|||
|
||||
email_changed = contact.will_save_change_to_email?
|
||||
old_email = contact.email_was
|
||||
contact.email_history = old_email
|
||||
updated = contact.save
|
||||
|
||||
if updated && email_changed && contact.registrant?
|
||||
|
|
|
@ -5,7 +5,8 @@ module Depp
|
|||
attr_accessor :id, :name, :email, :phone, :org_name,
|
||||
:ident, :ident_type, :ident_country_code,
|
||||
:street, :city, :zip, :state, :country_code,
|
||||
:password, :legal_document, :statuses, :code
|
||||
:password, :legal_document, :statuses, :code,
|
||||
:email_history
|
||||
|
||||
DISABLED = 'Disabled'
|
||||
DISCLOSURE_TYPES = [DISABLED, '1', '0']
|
||||
|
|
|
@ -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