mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 10:49:39 +02:00
Contact change notification email content update #2558
This commit is contained in:
parent
941538b924
commit
410914e16e
4 changed files with 53 additions and 11 deletions
|
@ -7,6 +7,7 @@ class Contact < ActiveRecord::Base
|
||||||
has_many :domains, through: :domain_contacts
|
has_many :domains, through: :domain_contacts
|
||||||
has_many :statuses, class_name: 'ContactStatus', dependent: :destroy
|
has_many :statuses, class_name: 'ContactStatus', dependent: :destroy
|
||||||
has_many :legal_documents, as: :documentable
|
has_many :legal_documents, as: :documentable
|
||||||
|
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id' # when contant is registrant
|
||||||
|
|
||||||
accepts_nested_attributes_for :legal_documents
|
accepts_nested_attributes_for :legal_documents
|
||||||
|
|
||||||
|
@ -184,4 +185,21 @@ class Contact < ActiveRecord::Base
|
||||||
errors.add(:ident, :invalid_country_code)
|
errors.add(:ident, :invalid_country_code)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def related_domain_descriptions
|
||||||
|
@desc = {}
|
||||||
|
|
||||||
|
registrant_domains.each do |dom|
|
||||||
|
@desc[dom.name] ||= []
|
||||||
|
@desc[dom.name] << :registrant
|
||||||
|
end
|
||||||
|
|
||||||
|
domain_contacts.each do |dc|
|
||||||
|
@desc[dc.domain.name] ||= []
|
||||||
|
@desc[dc.domain.name] << dc.name.downcase.to_sym
|
||||||
|
@desc[dc.domain.name] = @desc[dc.domain.name].compact
|
||||||
|
end
|
||||||
|
|
||||||
|
@desc
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,10 +6,10 @@ uus aadress: <%= @contact.email %>
|
||||||
<br><br>
|
<br><br>
|
||||||
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
<% if @contact.domain_contacts.present? %>
|
<% if @contact.related_domain_descriptions.present? %>
|
||||||
Muudatusega seotud domeenid:<br>
|
Muudatusega seotud domeenid:<br>
|
||||||
<% @contact.domain_contacts.each do |dc| %>
|
<% @contact.related_domain_descriptions.each do |domain, desc| %>
|
||||||
<%= dc.domain.name %> (<%= dc.name %>)<br>
|
<%= domain %> (<%= desc.map { |d| t(:d) }.join(', ') %>)<br>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<br>
|
<br>
|
||||||
|
@ -35,9 +35,11 @@ new address: <% @contact.email %>
|
||||||
<br><br>
|
<br><br>
|
||||||
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>
|
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
<% if @contact.related_domain_descriptions.present? %>
|
||||||
Domains affected by this update:<br>
|
Domains affected by this update:<br>
|
||||||
<% @contact.domain_contacts.each do |dc| %>
|
<% @contact.related_domain_descriptions.each do |domain, desc| %>
|
||||||
<%= dc.domain.name %> (<%= dc.name %>)<br>
|
<%= domain %> (<%= desc.map { |d| t(:d) }.join(', ') %>)<br>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<br>
|
<br>
|
||||||
Contact information:<br>
|
Contact information:<br>
|
||||||
|
|
|
@ -6,11 +6,11 @@ uus aadress: <%= @contact.email %>
|
||||||
|
|
||||||
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
Eposti aadressile saadetakse domeenidega seotud infot seal hulgas kinnitustaotluseid omaniku vahetuse ja domeeni kustutamise korral. Palun veenduge, et muudatus on korrektne ning probleemide korral pöörduga oma registripidaja poole. Teie registripidaja on <%= @contact.registrar.name %>
|
||||||
|
|
||||||
<% if @contact.domain_contacts.present? %>
|
<% if @contact.related_domain_descriptions.present? %>
|
||||||
Muudatusega seotud domeenid:
|
Muudatusega seotud domeenid:
|
||||||
<% @contact.domain_contacts.each do |dc| %>
|
<% @contact.related_domain_descriptions.each do |domain, desc| %>
|
||||||
<%= dc.domain.name %> (<%= dc.name %>)
|
<%= domain %> (<%= desc.map { |d| t(:d) }.join(', ') %>)
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
Kontaktandmed:
|
Kontaktandmed:
|
||||||
|
@ -35,9 +35,11 @@ new address: <% @contact.email %>
|
||||||
|
|
||||||
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>
|
E-mail addresses are used to send important information regarding your registered domains including applications for approval of registrant change and domain deletion. Please make sure that the update and contact information are correct. Incase of problems please turn to your registrar. Your registrar is <%= @contact.registrar.name %>
|
||||||
|
|
||||||
|
<% if @contact.related_domain_descriptions.present? %>
|
||||||
Domains affected by this update:
|
Domains affected by this update:
|
||||||
<% @contact.domain_contacts.each do |dc| %>
|
<% @contact.related_domain_descriptions.each do |domain, desc| %>
|
||||||
<%= dc.domain.name %> (<%= dc.name %>)
|
<%= domain %> (<%= desc.map { |d| t(:d) }.join(', ') %>)
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
Contact information:
|
Contact information:
|
||||||
|
|
|
@ -99,6 +99,10 @@ describe Contact do
|
||||||
@contact.valid?
|
@contact.valid?
|
||||||
@contact.errors[:code].should == ['is too long (maximum is 100 characters)']
|
@contact.errors[:code].should == ['is too long (maximum is 100 characters)']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should have no related domain descriptions' do
|
||||||
|
@contact.related_domain_descriptions.should == {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with valid attributes' do
|
context 'with valid attributes' do
|
||||||
|
@ -189,6 +193,22 @@ describe Contact do
|
||||||
# contact.statuses.map(&:value).should == %w(ok linked)
|
# contact.statuses.map(&:value).should == %w(ok linked)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'as birthday' do
|
||||||
|
before do
|
||||||
|
@domain = Fabricate(:domain)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should have related domain descriptions hash' do
|
||||||
|
contact = @domain.registrant
|
||||||
|
contact.related_domain_descriptions.should == { "#{@domain.name}" => [:registrant] }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should have related domain descriptions hash' do
|
||||||
|
contact = @domain.contacts.first
|
||||||
|
contact.related_domain_descriptions.should == { "#{@domain.name}" => [:admin] }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'as birthday' do
|
context 'as birthday' do
|
||||||
before :all do
|
before :all do
|
||||||
@contact.ident_type = 'birthday'
|
@contact.ident_type = 'birthday'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue