mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Improve readability
This commit is contained in:
parent
ffe11685ff
commit
eb1ee426ca
14 changed files with 48 additions and 47 deletions
|
@ -4,10 +4,10 @@ class RegistrantChangeConfirmEmailJob < Que::Job
|
||||||
new_registrant = Registrant.find(new_registrant_id)
|
new_registrant = Registrant.find(new_registrant_id)
|
||||||
|
|
||||||
log(domain)
|
log(domain)
|
||||||
RegistrantChangeMailer.confirm(domain: domain,
|
RegistrantChangeMailer.confirmation_request(domain: domain,
|
||||||
registrar: domain.registrar,
|
registrar: domain.registrar,
|
||||||
current_registrant: domain.registrant,
|
current_registrant: domain.registrant,
|
||||||
new_registrant: new_registrant).deliver_now
|
new_registrant: new_registrant).deliver_now
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -3,10 +3,10 @@ class RegistrantChangeNoticeEmailJob < Que::Job
|
||||||
domain = Domain.find(domain_id)
|
domain = Domain.find(domain_id)
|
||||||
new_registrant = Registrant.find(new_registrant_id)
|
new_registrant = Registrant.find(new_registrant_id)
|
||||||
log(domain, new_registrant)
|
log(domain, new_registrant)
|
||||||
RegistrantChangeMailer.notice(domain: domain,
|
RegistrantChangeMailer.notification(domain: domain,
|
||||||
registrar: domain.registrar,
|
registrar: domain.registrar,
|
||||||
current_registrant: domain.registrant,
|
current_registrant: domain.registrant,
|
||||||
new_registrant: new_registrant).deliver_now
|
new_registrant: new_registrant).deliver_now
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
class RegistrantChangeMailer < ApplicationMailer
|
class RegistrantChangeMailer < ApplicationMailer
|
||||||
helper_method :address_processing
|
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)
|
@domain = DomainPresenter.new(domain: domain, view: view_context)
|
||||||
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
|
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
|
||||||
@new_registrant = RegistrantPresenter.new(registrant: new_registrant, 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)
|
subject = default_i18n_subject(domain_name: domain.name)
|
||||||
mail(to: current_registrant.email, subject: subject)
|
mail(to: current_registrant.email, subject: subject)
|
||||||
end
|
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)
|
@domain = DomainPresenter.new(domain: domain, view: view_context)
|
||||||
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
|
@registrar = RegistrarPresenter.new(registrar: registrar, view: view_context)
|
||||||
@current_registrant = RegistrantPresenter.new(registrant: current_registrant, 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)
|
mail(to: new_registrant.email, subject: subject)
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmed(domain:, old_registrant:)
|
def accepted(domain:, old_registrant:)
|
||||||
@domain = domain
|
@domain = domain
|
||||||
recipients = [domain.registrant.email, old_registrant.email]
|
recipients = [domain.registrant.email, old_registrant.email]
|
||||||
subject = default_i18n_subject(domain_name: domain.name)
|
subject = default_i18n_subject(domain_name: domain.name)
|
||||||
|
@ -49,7 +49,7 @@ class RegistrantChangeMailer < ApplicationMailer
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def confirm_url(domain)
|
def confirmation_url(domain)
|
||||||
registrant_domain_update_confirm_url(domain, token: domain.registrant_verification_token)
|
registrant_domain_update_confirm_url(domain, token: domain.registrant_verification_token)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class RegistrantChange
|
||||||
private
|
private
|
||||||
|
|
||||||
def notify_registrant
|
def notify_registrant
|
||||||
RegistrantChangeMailer.confirmed(domain: domain, old_registrant: old_registrant).deliver_now
|
RegistrantChangeMailer.accepted(domain: domain, old_registrant: old_registrant).deliver_now
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :domain
|
attr_reader :domain
|
||||||
|
|
|
@ -12,7 +12,7 @@ Taotlus on aktiivne <%= Setting.expire_pending_confirmation %> tundi ja lükatak
|
||||||
<br><br>
|
<br><br>
|
||||||
Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:<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>
|
<br><br>
|
||||||
Lugupidamisega<br>
|
Lugupidamisega<br>
|
||||||
Eesti Interneti Sihtasutus
|
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.
|
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>
|
<br><br>
|
||||||
To confirm the update please visit this website, once again review the data and press approve:<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>
|
<br><br>
|
||||||
Best Regards,<br>
|
Best Regards,<br>
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
|
@ -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.
|
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:
|
Muudatuse kinnitamiseks külastage palun allolevat lehekülge, kontrollige uuesti üle muudatuse andmed ning vajutage nuppu kinnitan:
|
||||||
<%= @confirm_url %>
|
<%= @confirmation_url %>
|
||||||
|
|
||||||
Lugupidamisega
|
Lugupidamisega
|
||||||
Eesti Interneti Sihtasutus
|
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.
|
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:
|
To confirm the update please visit this website, once again review the data and press approve:
|
||||||
<%= @confirm_url %>
|
<%= @confirmation_url %>
|
||||||
|
|
||||||
Best Regards,
|
Best Regards,
|
||||||
Estonian Internet Foundation
|
Estonian Internet Foundation
|
|
@ -1,14 +1,14 @@
|
||||||
en:
|
en:
|
||||||
registrant_change_mailer:
|
registrant_change_mailer:
|
||||||
confirm:
|
confirmation_request:
|
||||||
subject: Kinnitustaotlus domeeni %{domain_name} registreerija vahetuseks / Application for approval for registrant change of %{domain_name}
|
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
|
subject: Domeeni %{domain_name} registreerija vahetus protseduur on algatatud / %{domain_name} registrant change
|
||||||
rejected:
|
accepted:
|
||||||
subject: Domeeni %{domain_name} registreerija vahetuse taotlus tagasi lükatud / %{domain_name} registrant change declined
|
|
||||||
confirmed:
|
|
||||||
subject: >-
|
subject: >-
|
||||||
Domeeni %{domain_name} registreerija vahetus teostatud
|
Domeeni %{domain_name} registreerija vahetus teostatud
|
||||||
/ Registrant change of %{domain_name} has been finished
|
/ 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:
|
expired:
|
||||||
subject: Domeeni %{domain_name} registreerija vahetuse taotlus on tühistatud / %{domain_name} registrant change cancelled
|
subject: Domeeni %{domain_name} registreerija vahetuse taotlus on tühistatud / %{domain_name} registrant change cancelled
|
||||||
|
|
|
@ -7,7 +7,7 @@ RSpec.describe RegistrantChange do
|
||||||
let(:message) { instance_spy(ActionMailer::MessageDelivery) }
|
let(:message) { instance_spy(ActionMailer::MessageDelivery) }
|
||||||
|
|
||||||
before :example do
|
before :example do
|
||||||
allow(RegistrantChangeMailer).to receive(:confirmed)
|
allow(RegistrantChangeMailer).to receive(:accepted)
|
||||||
.with(domain: domain, old_registrant: old_registrant)
|
.with(domain: domain, old_registrant: old_registrant)
|
||||||
.and_return(message)
|
.and_return(message)
|
||||||
described_class.new(domain: domain, old_registrant: old_registrant).confirm
|
described_class.new(domain: domain, old_registrant: old_registrant).confirm
|
||||||
|
|
|
@ -6,31 +6,31 @@ class RegistrantChangeMailerPreview < ActionMailer::Preview
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmation_request
|
def confirmation_request
|
||||||
RegistrantChangeMailer.confirm(domain: @domain,
|
RegistrantChangeMailer.confirmation_request(domain: @domain,
|
||||||
registrar: @domain.registrar,
|
registrar: @domain.registrar,
|
||||||
current_registrant: @domain.registrant,
|
current_registrant: @domain.registrant,
|
||||||
new_registrant: @new_registrant)
|
new_registrant: @new_registrant)
|
||||||
end
|
end
|
||||||
|
|
||||||
def notification
|
def notification
|
||||||
RegistrantChangeMailer.notice(domain: @domain,
|
RegistrantChangeMailer.notification(domain: @domain,
|
||||||
registrar: @domain.registrar,
|
registrar: @domain.registrar,
|
||||||
current_registrant: @domain.registrant,
|
current_registrant: @domain.registrant,
|
||||||
new_registrant: @new_registrant)
|
new_registrant: @new_registrant)
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmation_accepted
|
def accepted
|
||||||
RegistrantChangeMailer.confirmed(domain: @domain,
|
RegistrantChangeMailer.accepted(domain: @domain,
|
||||||
old_registrant: @domain.registrar)
|
old_registrant: @domain.registrar)
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmation_rejected
|
def rejected
|
||||||
RegistrantChangeMailer.rejected(domain: @domain,
|
RegistrantChangeMailer.rejected(domain: @domain,
|
||||||
registrar: @domain.registrar,
|
registrar: @domain.registrar,
|
||||||
registrant: @domain.registrant)
|
registrant: @domain.registrant)
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirmation_expired
|
def expired
|
||||||
RegistrantChangeMailer.expired(domain: @domain,
|
RegistrantChangeMailer.expired(domain: @domain,
|
||||||
registrar: @domain.registrar,
|
registrar: @domain.registrar,
|
||||||
registrant: @domain.registrant)
|
registrant: @domain.registrant)
|
||||||
|
|
|
@ -12,10 +12,11 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase
|
||||||
assert_equal 'shop.test', @domain.name
|
assert_equal 'shop.test', @domain.name
|
||||||
assert_equal 'john@inbox.test', @domain.registrant.email
|
assert_equal 'john@inbox.test', @domain.registrant.email
|
||||||
|
|
||||||
email = RegistrantChangeMailer.confirm(domain: @domain,
|
email = RegistrantChangeMailer.confirmation_request(domain: @domain,
|
||||||
registrar: @domain.registrar,
|
registrar: @domain.registrar,
|
||||||
current_registrant: @domain.registrant,
|
current_registrant: @domain.registrant,
|
||||||
new_registrant: @domain.registrant).deliver_now
|
new_registrant: @domain.registrant)
|
||||||
|
.deliver_now
|
||||||
|
|
||||||
assert_emails 1
|
assert_emails 1
|
||||||
assert_equal ['john@inbox.test'], email.to
|
assert_equal ['john@inbox.test'], email.to
|
||||||
|
@ -28,10 +29,10 @@ class RegistrantChangeMailerTest < ActiveSupport::TestCase
|
||||||
assert_equal 'shop.test', @domain.name
|
assert_equal 'shop.test', @domain.name
|
||||||
assert_equal 'william@inbox.test', new_registrant.email
|
assert_equal 'william@inbox.test', new_registrant.email
|
||||||
|
|
||||||
email = RegistrantChangeMailer.notice(domain: @domain,
|
email = RegistrantChangeMailer.notification(domain: @domain,
|
||||||
registrar: @domain.registrar,
|
registrar: @domain.registrar,
|
||||||
current_registrant: @domain.registrant,
|
current_registrant: @domain.registrant,
|
||||||
new_registrant: new_registrant).deliver_now
|
new_registrant: new_registrant).deliver_now
|
||||||
|
|
||||||
assert_emails 1
|
assert_emails 1
|
||||||
assert_equal ['william@inbox.test'], email.to
|
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 'john@inbox.test', @domain.registrant.email
|
||||||
assert_equal 'william@inbox.test', new_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
|
old_registrant: new_registrant).deliver_now
|
||||||
|
|
||||||
assert_emails 1
|
assert_emails 1
|
||||||
assert_equal %w[john@inbox.test william@inbox.test], email.to
|
assert_equal %w[john@inbox.test william@inbox.test], email.to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue