Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Martin Lensment 2015-06-10 14:28:27 +03:00
commit 414b906261
3 changed files with 38 additions and 28 deletions

View file

@ -8,7 +8,14 @@ class ContactMailer < ApplicationMailer
return if contact.deliver_emails != true return if contact.deliver_emails != true
@contact = contact @contact = contact
mail(to: [@contact.email, @contact.email_was],
subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]") emails = []
emails << [@contact.email, @contact.email_was] if @contact.registrant_domains.present?
emails << @contact.domains.map(&:email) if @contact.domains.present?
emails = emails.uniq
emails.each do |email|
mail(to: email, subject: "#{I18n.t(:contact_email_update_subject)} [#{@contact.code}]")
end
end end
end end

View file

@ -1,29 +1,30 @@
.panel.panel-default - if !@contact.persisted?
.panel-heading.clearfix .panel.panel-default
.pull-left= t(:ident) .panel-heading.clearfix
.panel-body .pull-left= t(:ident)
.form-group .panel-body
.col-md-3.control-label .form-group
= f.label :ident_country_code, t(:country) + '*' .col-md-3.control-label
.col-md-7 = f.label :ident_country_code, t(:country) + '*'
= f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {}, .col-md-7
class: 'js-ident-country-code', required: true) = f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {},
class: 'js-ident-country-code', required: true)
.form-group .form-group
.col-md-3.control-label .col-md-3.control-label
= f.label :ident_type, t(:type) + '*' = f.label :ident_type, t(:type) + '*'
.col-md-7 .col-md-7
= f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type }, = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type },
class: 'js-ident-type', required: true) class: 'js-ident-type', required: true)
.form-group .form-group
.col-md-3.control-label .col-md-3.control-label
= f.label :ident, t(:ident) + '*' = f.label :ident, t(:ident) + '*'
.col-md-7 .col-md-7
= f.text_field :ident, class: 'form-control', required: true = f.text_field :ident, class: 'form-control', required: true
- tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none'
.js-ident-tip{ style: tip_visibility } .js-ident-tip{ style: tip_visibility }
= t(:birthday_format) = t(:birthday_format)
.panel.panel-default .panel.panel-default
.panel-heading.clearfix .panel-heading.clearfix

View file

@ -27,7 +27,8 @@ describe ContactMailer do
describe 'email changed notification' do describe 'email changed notification' do
before :all do before :all do
@contact = Fabricate(:contact, email: 'test@example.com') @domain = Fabricate(:domain)
@contact = @domain.registrant
@contact.deliver_emails = true @contact.deliver_emails = true
@contact.email = 'test@example.org' # new email @contact.email = 'test@example.org' # new email
@mail = ContactMailer.email_updated(@contact) @mail = ContactMailer.email_updated(@contact)
@ -42,7 +43,8 @@ describe ContactMailer do
end end
it 'should have both old and new receiver email' do it 'should have both old and new receiver email' do
@mail.to.should == ["test@example.org", "test@example.com"] @mail.to.size.should == 2
@mail.to.include? "test@example.org"
end end
it 'should render body' do it 'should render body' do