Improve readability

This commit is contained in:
Artur Beljajev 2019-04-05 20:22:01 +03:00
parent ffe11685ff
commit eb1ee426ca
14 changed files with 48 additions and 47 deletions

View file

@ -4,7 +4,7 @@ class RegistrantChangeConfirmEmailJob < Que::Job
new_registrant = Registrant.find(new_registrant_id)
log(domain)
RegistrantChangeMailer.confirm(domain: domain,
RegistrantChangeMailer.confirmation_request(domain: domain,
registrar: domain.registrar,
current_registrant: domain.registrant,
new_registrant: new_registrant).deliver_now

View file

@ -3,7 +3,7 @@ class RegistrantChangeNoticeEmailJob < Que::Job
domain = Domain.find(domain_id)
new_registrant = Registrant.find(new_registrant_id)
log(domain, new_registrant)
RegistrantChangeMailer.notice(domain: domain,
RegistrantChangeMailer.notification(domain: domain,
registrar: domain.registrar,
current_registrant: domain.registrant,
new_registrant: new_registrant).deliver_now

View file

@ -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

View file

@ -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

View file

@ -12,7 +12,7 @@ Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatak
<br><br>
Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:<br>
<%= link_to @confirm_url, @confirm_url %>
<%= link_to @confirmation_url, @confirmation_url %>
<br><br>
Lugupidamisega<br>
Eesti Interneti Sihtasutus
@ -32,7 +32,7 @@ New registrant:<br>
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.
<br><br>
To confirm the update please visit this website, once again review the data and press approve:<br>
<%= link_to @confirm_url, @confirm_url %>
<%= link_to @confirmation_url, @confirmation_url %>
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -6,31 +6,31 @@ class RegistrantChangeMailerPreview < ActionMailer::Preview
end
def confirmation_request
RegistrantChangeMailer.confirm(domain: @domain,
RegistrantChangeMailer.confirmation_request(domain: @domain,
registrar: @domain.registrar,
current_registrant: @domain.registrant,
new_registrant: @new_registrant)
end
def notification
RegistrantChangeMailer.notice(domain: @domain,
RegistrantChangeMailer.notification(domain: @domain,
registrar: @domain.registrar,
current_registrant: @domain.registrant,
new_registrant: @new_registrant)
end
def confirmation_accepted
RegistrantChangeMailer.confirmed(domain: @domain,
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)

View file

@ -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,
email = RegistrantChangeMailer.confirmation_request(domain: @domain,
registrar: @domain.registrar,
current_registrant: @domain.registrant,
new_registrant: @domain.registrant).deliver_now
new_registrant: @domain.registrant)
.deliver_now
assert_emails 1
assert_equal ['john@inbox.test'], email.to
@ -28,7 +29,7 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase
assert_equal 'shop.test', @domain.name
assert_equal 'william@inbox.test', new_registrant.email
email = RegistrantChangeMailer.notice(domain: @domain,
email = RegistrantChangeMailer.notification(domain: @domain,
registrar: @domain.registrar,
current_registrant: @domain.registrant,
new_registrant: new_registrant).deliver_now
@ -45,7 +46,7 @@ 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,
email = RegistrantChangeMailer.accepted(domain: @domain,
old_registrant: new_registrant).deliver_now
assert_emails 1