Improve ContactMailer

- Add detailed registrar info
- Refactor contact domain list
- Fix english translation

#480
This commit is contained in:
Artur Beljajev 2017-06-08 02:06:00 +03:00
parent 37004c24ba
commit 49552fc67e
11 changed files with 220 additions and 37 deletions

View file

@ -429,6 +429,8 @@ class Contact < ActiveRecord::Base
end
def related_domain_descriptions
ActiveSupport::Deprecation.warn('Use #domain_names_with_roles')
@desc = {}
registrant_domains.each do |dom|
@ -598,4 +600,24 @@ class Contact < ActiveRecord::Base
def ident_country
Country.new(ident_country_code)
end
def used?
registrant_domains.any? || domain_contacts.any?
end
def domain_names_with_roles
domain_names = {}
registrant_domains.pluck(:name).each do |domain_name|
domain_names[domain_name] ||= Set.new
domain_names[domain_name] << Registrant.name.underscore.to_sym
end
domain_contacts.each do |domain_contact|
domain_names[domain_contact.domain.name] ||= Set.new
domain_names[domain_contact.domain.name] << domain_contact.type.underscore.to_sym
end
domain_names
end
end