Story#116761157 - contact statuses are generated value

This commit is contained in:
Vladimir Krylov 2016-05-27 09:30:48 +03:00
parent 105d7bf645
commit f2c96ba145
2 changed files with 15 additions and 74 deletions

View file

@ -39,29 +39,12 @@ class Epp::Domain < Domain
before_save :link_contacts
def link_contacts
# Based on bullet report
if new_record?
# new record does not have correct instance contacts entries thanks to epp
unlinked_contacts = [registrant]
unlinked_contacts << admin_domain_contacts.map(&:contact)
unlinked_contacts << tech_domain_contacts.map(&:contact)
unlinked_contacts.flatten!
else
unlinked_contacts = contacts.select { |c| !c.linked? } # speed up a bit
end
unlinked_contacts.each do |uc|
uc.domains_present = true # no need to fetch domains again
uc.save(validate: false)
end
#TODO: cleanup cache if we think to cache dynamic statuses
end
after_destroy :unlink_contacts
def unlink_contacts
contacts.each do |c|
c.domains_present = false
c.save(validate: false)
end
#TODO: cleanup cache if we think to cache dynamic statuses
end
class << self