diff --git a/app/jobs/registrant_change_confirm_email_job.rb b/app/jobs/registrant_change_confirm_email_job.rb index 0fced48d8..2883c10a6 100644 --- a/app/jobs/registrant_change_confirm_email_job.rb +++ b/app/jobs/registrant_change_confirm_email_job.rb @@ -4,10 +4,10 @@ class RegistrantChangeConfirmEmailJob < Que::Job new_registrant = Registrant.find(new_registrant_id) log(domain) - RegistrantChangeMailer.confirm(domain: domain, - registrar: domain.registrar, - current_registrant: domain.registrant, - new_registrant: new_registrant).deliver_now + RegistrantChangeMailer.confirmation_request(domain: domain, + registrar: domain.registrar, + current_registrant: domain.registrant, + new_registrant: new_registrant).deliver_now end private diff --git a/app/jobs/registrant_change_notice_email_job.rb b/app/jobs/registrant_change_notice_email_job.rb index a0bf26c52..cabd1db7f 100644 --- a/app/jobs/registrant_change_notice_email_job.rb +++ b/app/jobs/registrant_change_notice_email_job.rb @@ -3,10 +3,10 @@ class RegistrantChangeNoticeEmailJob < Que::Job domain = Domain.find(domain_id) new_registrant = Registrant.find(new_registrant_id) log(domain, new_registrant) - RegistrantChangeMailer.notice(domain: domain, - registrar: domain.registrar, - current_registrant: domain.registrant, - new_registrant: new_registrant).deliver_now + RegistrantChangeMailer.notification(domain: domain, + registrar: domain.registrar, + current_registrant: domain.registrant, + new_registrant: new_registrant).deliver_now end private diff --git a/app/mailers/registrant_change_mailer.rb b/app/mailers/registrant_change_mailer.rb index 2ba7e497e..ff3cfa18e 100644 --- a/app/mailers/registrant_change_mailer.rb +++ b/app/mailers/registrant_change_mailer.rb @@ -1,17 +1,17 @@ class RegistrantChangeMailer < ApplicationMailer helper_method :address_processing - def confirm(domain:, registrar:, current_registrant:, new_registrant:) + def confirmation_request(domain:, registrar:, current_registrant:, new_registrant:) @domain = DomainPresenter.new(domain: domain, view: view_context) @registrar = RegistrarPresenter.new(registrar: registrar, view: view_context) @new_registrant = RegistrantPresenter.new(registrant: new_registrant, view: view_context) - @confirm_url = confirm_url(domain) + @confirmation_url = confirmation_url(domain) subject = default_i18n_subject(domain_name: domain.name) mail(to: current_registrant.email, subject: subject) end - def notice(domain:, registrar:, current_registrant:, new_registrant:) + def notification(domain:, registrar:, current_registrant:, new_registrant:) @domain = DomainPresenter.new(domain: domain, view: view_context) @registrar = RegistrarPresenter.new(registrar: registrar, view: view_context) @current_registrant = RegistrantPresenter.new(registrant: current_registrant, view: view_context) @@ -21,7 +21,7 @@ class RegistrantChangeMailer < ApplicationMailer mail(to: new_registrant.email, subject: subject) end - def confirmed(domain:, old_registrant:) + def accepted(domain:, old_registrant:) @domain = domain recipients = [domain.registrant.email, old_registrant.email] subject = default_i18n_subject(domain_name: domain.name) @@ -49,7 +49,7 @@ class RegistrantChangeMailer < ApplicationMailer private - def confirm_url(domain) + def confirmation_url(domain) registrant_domain_update_confirm_url(domain, token: domain.registrant_verification_token) end diff --git a/app/services/registrant_change.rb b/app/services/registrant_change.rb index a820dbe8d..35b631fb6 100644 --- a/app/services/registrant_change.rb +++ b/app/services/registrant_change.rb @@ -11,7 +11,7 @@ class RegistrantChange private def notify_registrant - RegistrantChangeMailer.confirmed(domain: domain, old_registrant: old_registrant).deliver_now + RegistrantChangeMailer.accepted(domain: domain, old_registrant: old_registrant).deliver_now end attr_reader :domain diff --git a/app/views/mailers/registrant_change_mailer/confirmed.html.erb b/app/views/mailers/registrant_change_mailer/accepted.html.erb similarity index 100% rename from app/views/mailers/registrant_change_mailer/confirmed.html.erb rename to app/views/mailers/registrant_change_mailer/accepted.html.erb diff --git a/app/views/mailers/registrant_change_mailer/confirmed.text.erb b/app/views/mailers/registrant_change_mailer/accepted.text.erb similarity index 100% rename from app/views/mailers/registrant_change_mailer/confirmed.text.erb rename to app/views/mailers/registrant_change_mailer/accepted.text.erb diff --git a/app/views/mailers/registrant_change_mailer/confirm.html.erb b/app/views/mailers/registrant_change_mailer/confirmation_request.html.erb similarity index 93% rename from app/views/mailers/registrant_change_mailer/confirm.html.erb rename to app/views/mailers/registrant_change_mailer/confirmation_request.html.erb index a2e889dc6..a867ffe3d 100644 --- a/app/views/mailers/registrant_change_mailer/confirm.html.erb +++ b/app/views/mailers/registrant_change_mailer/confirmation_request.html.erb @@ -12,7 +12,7 @@ Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatak

Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
-<%= link_to @confirm_url, @confirm_url %> +<%= link_to @confirmation_url, @confirmation_url %>

Lugupidamisega
Eesti Interneti Sihtasutus @@ -32,7 +32,7 @@ New registrant:
The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before.

To confirm the update please visit this website, once again review the data and press approve:
-<%= link_to @confirm_url, @confirm_url %> +<%= link_to @confirmation_url, @confirmation_url %>

Best Regards,
Estonian Internet Foundation diff --git a/app/views/mailers/registrant_change_mailer/confirm.text.erb b/app/views/mailers/registrant_change_mailer/confirmation_request.text.erb similarity index 96% rename from app/views/mailers/registrant_change_mailer/confirm.text.erb rename to app/views/mailers/registrant_change_mailer/confirmation_request.text.erb index 2af2381fc..6bcc0322b 100644 --- a/app/views/mailers/registrant_change_mailer/confirm.text.erb +++ b/app/views/mailers/registrant_change_mailer/confirmation_request.text.erb @@ -9,7 +9,7 @@ Uue registreerija andmed: Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatakse automaatselt tagasi kui te seda enne ei kinnita või tagasi lükka. Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan: -<%= @confirm_url %> +<%= @confirmation_url %> Lugupidamisega Eesti Interneti Sihtasutus @@ -27,7 +27,7 @@ New registrant: The application will remain in pending status for <%= Setting.expire_pending_confirmation %> hrs and will be automaticcally rejected if it is not approved nor rejected before. To confirm the update please visit this website, once again review the data and press approve: -<%= @confirm_url %> +<%= @confirmation_url %> Best Regards, Estonian Internet Foundation diff --git a/app/views/mailers/registrant_change_mailer/notice.html.erb b/app/views/mailers/registrant_change_mailer/notification.html.erb similarity index 100% rename from app/views/mailers/registrant_change_mailer/notice.html.erb rename to app/views/mailers/registrant_change_mailer/notification.html.erb diff --git a/app/views/mailers/registrant_change_mailer/notice.text.erb b/app/views/mailers/registrant_change_mailer/notification.text.erb similarity index 100% rename from app/views/mailers/registrant_change_mailer/notice.text.erb rename to app/views/mailers/registrant_change_mailer/notification.text.erb diff --git a/config/locales/mailers/registrant_change.en.yml b/config/locales/mailers/registrant_change.en.yml index 87a7cc492..a78991f0c 100644 --- a/config/locales/mailers/registrant_change.en.yml +++ b/config/locales/mailers/registrant_change.en.yml @@ -1,14 +1,14 @@ en: registrant_change_mailer: - confirm: + confirmation_request: subject: Kinnitustaotlus domeeni %{domain_name} registreerija vahetuseks / Application for approval for registrant change of %{domain_name} - notice: + notification: subject: Domeeni %{domain_name} registreerija vahetus protseduur on algatatud / %{domain_name} registrant change - rejected: - subject: Domeeni %{domain_name} registreerija vahetuse taotlus tagasi lükatud / %{domain_name} registrant change declined - confirmed: + accepted: subject: >- Domeeni %{domain_name} registreerija vahetus teostatud / Registrant change of %{domain_name} has been finished + rejected: + subject: Domeeni %{domain_name} registreerija vahetuse taotlus tagasi lükatud / %{domain_name} registrant change declined expired: subject: Domeeni %{domain_name} registreerija vahetuse taotlus on tühistatud / %{domain_name} registrant change cancelled diff --git a/spec/services/registrant_change_spec.rb b/spec/services/registrant_change_spec.rb index fb1762557..598874109 100644 --- a/spec/services/registrant_change_spec.rb +++ b/spec/services/registrant_change_spec.rb @@ -7,7 +7,7 @@ RSpec.describe RegistrantChange do let(:message) { instance_spy(ActionMailer::MessageDelivery) } before :example do - allow(RegistrantChangeMailer).to receive(:confirmed) + allow(RegistrantChangeMailer).to receive(:accepted) .with(domain: domain, old_registrant: old_registrant) .and_return(message) described_class.new(domain: domain, old_registrant: old_registrant).confirm diff --git a/test/mailers/previews/registrant_change_mailer_preview.rb b/test/mailers/previews/registrant_change_mailer_preview.rb index 0a8f25716..dec948fe6 100644 --- a/test/mailers/previews/registrant_change_mailer_preview.rb +++ b/test/mailers/previews/registrant_change_mailer_preview.rb @@ -6,31 +6,31 @@ class RegistrantChangeMailerPreview < ActionMailer::Preview end def confirmation_request - RegistrantChangeMailer.confirm(domain: @domain, - registrar: @domain.registrar, - current_registrant: @domain.registrant, - new_registrant: @new_registrant) + RegistrantChangeMailer.confirmation_request(domain: @domain, + registrar: @domain.registrar, + current_registrant: @domain.registrant, + new_registrant: @new_registrant) end def notification - RegistrantChangeMailer.notice(domain: @domain, - registrar: @domain.registrar, - current_registrant: @domain.registrant, - new_registrant: @new_registrant) + RegistrantChangeMailer.notification(domain: @domain, + registrar: @domain.registrar, + current_registrant: @domain.registrant, + new_registrant: @new_registrant) end - def confirmation_accepted - RegistrantChangeMailer.confirmed(domain: @domain, - old_registrant: @domain.registrar) + def accepted + RegistrantChangeMailer.accepted(domain: @domain, + old_registrant: @domain.registrar) end - def confirmation_rejected + def rejected RegistrantChangeMailer.rejected(domain: @domain, registrar: @domain.registrar, registrant: @domain.registrant) end - def confirmation_expired + def expired RegistrantChangeMailer.expired(domain: @domain, registrar: @domain.registrar, registrant: @domain.registrant) diff --git a/test/mailers/registrant_change_mailer_test.rb b/test/mailers/registrant_change_mailer_test.rb index ebe5847d6..a4b35499c 100644 --- a/test/mailers/registrant_change_mailer_test.rb +++ b/test/mailers/registrant_change_mailer_test.rb @@ -12,10 +12,11 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase assert_equal 'shop.test', @domain.name assert_equal 'john@inbox.test', @domain.registrant.email - email = RegistrantChangeMailer.confirm(domain: @domain, - registrar: @domain.registrar, - current_registrant: @domain.registrant, - new_registrant: @domain.registrant).deliver_now + email = RegistrantChangeMailer.confirmation_request(domain: @domain, + registrar: @domain.registrar, + current_registrant: @domain.registrant, + new_registrant: @domain.registrant) + .deliver_now assert_emails 1 assert_equal ['john@inbox.test'], email.to @@ -28,10 +29,10 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase assert_equal 'shop.test', @domain.name assert_equal 'william@inbox.test', new_registrant.email - email = RegistrantChangeMailer.notice(domain: @domain, - registrar: @domain.registrar, - current_registrant: @domain.registrant, - new_registrant: new_registrant).deliver_now + email = RegistrantChangeMailer.notification(domain: @domain, + registrar: @domain.registrar, + current_registrant: @domain.registrant, + new_registrant: new_registrant).deliver_now assert_emails 1 assert_equal ['william@inbox.test'], email.to @@ -45,8 +46,8 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase assert_equal 'john@inbox.test', @domain.registrant.email assert_equal 'william@inbox.test', new_registrant.email - email = RegistrantChangeMailer.confirmed(domain: @domain, - old_registrant: new_registrant).deliver_now + email = RegistrantChangeMailer.accepted(domain: @domain, + old_registrant: new_registrant).deliver_now assert_emails 1 assert_equal %w[john@inbox.test william@inbox.test], email.to