From f6b61a7ac52c330fa830a8da4746fd00bd8104d9 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 10 Jun 2015 14:14:54 +0300 Subject: [PATCH 1/2] Contact email change notification update #2558 --- app/mailers/contact_mailer.rb | 11 +++++++++-- spec/mailers/contact_mailer_spec.rb | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index 4db130006..cf8c03d38 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -8,7 +8,14 @@ class ContactMailer < ApplicationMailer return if contact.deliver_emails != true @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 diff --git a/spec/mailers/contact_mailer_spec.rb b/spec/mailers/contact_mailer_spec.rb index 76b98e717..9f825b380 100644 --- a/spec/mailers/contact_mailer_spec.rb +++ b/spec/mailers/contact_mailer_spec.rb @@ -27,7 +27,8 @@ describe ContactMailer do describe 'email changed notification' do before :all do - @contact = Fabricate(:contact, email: 'test@example.com') + @domain = Fabricate(:domain) + @contact = @domain.registrant @contact.deliver_emails = true @contact.email = 'test@example.org' # new email @mail = ContactMailer.email_updated(@contact) @@ -42,7 +43,8 @@ describe ContactMailer do end 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 it 'should render body' do From 4d51a8e575cac93970a7ea4e30cd0ce232a35849 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Wed, 10 Jun 2015 14:20:09 +0300 Subject: [PATCH 2/2] Registrar ident update #2618 --- .../contacts/form_partials/_general.haml | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/app/views/registrar/contacts/form_partials/_general.haml b/app/views/registrar/contacts/form_partials/_general.haml index 623d27c18..14037f05b 100644 --- a/app/views/registrar/contacts/form_partials/_general.haml +++ b/app/views/registrar/contacts/form_partials/_general.haml @@ -1,29 +1,30 @@ -.panel.panel-default - .panel-heading.clearfix - .pull-left= t(:ident) - .panel-body - .form-group - .col-md-3.control-label - = f.label :ident_country_code, t(:country) + '*' - .col-md-7 - = f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {}, - class: 'js-ident-country-code', required: true) +- if !@contact.persisted? + .panel.panel-default + .panel-heading.clearfix + .pull-left= t(:ident) + .panel-body + .form-group + .col-md-3.control-label + = f.label :ident_country_code, t(:country) + '*' + .col-md-7 + = f.select(:ident_country_code, SortedCountry.all_options(f.object.ident_country_code), {}, + class: 'js-ident-country-code', required: true) - .form-group - .col-md-3.control-label - = f.label :ident_type, t(:type) + '*' - .col-md-7 - = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type }, - class: 'js-ident-type', required: true) + .form-group + .col-md-3.control-label + = f.label :ident_type, t(:type) + '*' + .col-md-7 + = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: f.object.ident_type }, + class: 'js-ident-type', required: true) - .form-group - .col-md-3.control-label - = f.label :ident, t(:ident) + '*' - .col-md-7 - = f.text_field :ident, class: 'form-control', required: true - - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' - .js-ident-tip{ style: tip_visibility } - = t(:birthday_format) + .form-group + .col-md-3.control-label + = f.label :ident, t(:ident) + '*' + .col-md-7 + = f.text_field :ident, class: 'form-control', required: true + - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none' + .js-ident-tip{ style: tip_visibility } + = t(:birthday_format) .panel.panel-default .panel-heading.clearfix