Merge pull request #1131 from internetee/remove-delegations

Remove delegations
This commit is contained in:
Timo Võhmar 2019-04-05 14:44:20 +03:00 committed by GitHub
commit 38ff7d4064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 30 additions and 46 deletions

View file

@ -12,7 +12,7 @@ class DomainDeleteConfirmEmailJob < Que::Job
def log(domain)
message = "Send DomainDeleteMailer#confirm email for domain #{domain.name} (##{domain.id})" \
" to #{domain.registrant_email}"
" to #{domain.registrant.email}"
logger.info(message)
end

View file

@ -13,7 +13,7 @@ class RegistrantChangeConfirmEmailJob < Que::Job
private
def log(domain)
message = "Send RegistrantChangeMailer#confirm email for domain #{domain.name} (##{domain.id}) to #{domain.registrant_email}"
message = "Send RegistrantChangeMailer#confirm email for domain #{domain.name} (##{domain.id}) to #{domain.registrant.email}"
logger.info(message)
end

View file

@ -23,7 +23,7 @@ class RegistrantChangeMailer < ApplicationMailer
def confirmed(domain:, old_registrant:)
@domain = domain
recipients = [domain.registrant_email, old_registrant.email]
recipients = [domain.registrant.email, old_registrant.email]
subject = default_i18n_subject(domain_name: domain.name)
mail(to: recipients, subject: subject)

View file

@ -59,7 +59,6 @@ class Contact < ActiveRecord::Base
return nil unless deliver_emails == true
emails = []
emails << [email, email_was]
# emails << domains.map(&:registrant_email) if domains.present?
emails = emails.flatten.uniq
emails.each do |e|
ContactMailer.email_updated(email_was, e, id, deliver_emails).deliver

View file

@ -59,20 +59,6 @@ class Domain < ActiveRecord::Base
has_many :legal_documents, as: :documentable
accepts_nested_attributes_for :legal_documents, reject_if: proc { |attrs| attrs[:body].blank? }
delegate :name, to: :registrant, prefix: true
delegate :code, to: :registrant, prefix: true
delegate :ident, to: :registrant, prefix: true
delegate :email, to: :registrant, prefix: true
delegate :phone, to: :registrant, prefix: true
delegate :street, to: :registrant, prefix: true
delegate :city, to: :registrant, prefix: true
delegate :zip, to: :registrant, prefix: true
delegate :state, to: :registrant, prefix: true
delegate :country, to: :registrant, prefix: true
delegate :name, to: :registrar, prefix: true
delegate :street, to: :registrar, prefix: true
after_initialize do
self.pending_json = {} if pending_json.blank?
self.statuses = [] if statuses.nil?

View file

@ -1,5 +1,5 @@
class DomainPresenter
delegate :name, :transfer_code, :registrant_name, :registrant_id, :registrant_code, to: :domain
delegate :name, :transfer_code, :registrant, :registrant_id, to: :domain
def initialize(domain:, view:)
@domain = domain

View file

@ -34,8 +34,8 @@ class Registrar::DomainListCSVPresenter
row = []
row[0] = domain.name
row[1] = domain.transfer_code
row[2] = domain.registrant_name
row[3] = domain.registrant_code
row[2] = domain.registrant.name
row[3] = domain.registrant.code
row[4] = domain.expire_date
row

View file

@ -7,13 +7,13 @@
%dd= link_to(@domain.registrant, [:admin, @domain.registrant])
%dt= t(:id)
%dd= @domain.registrant_code
%dd= @domain.registrant.code
%dt= t(:identity_code)
%dd= @domain.registrant_ident
%dd= @domain.registrant.ident
%dt= t(:email)
%dd= @domain.registrant_email
%dd= @domain.registrant.email
%dt= t(:phone)
%dd= @domain.registrant_phone
%dd= @domain.registrant.phone

View file

@ -12,7 +12,7 @@ xml.epp_head do
xml.tag!('domain:status', 's' => s)
end
xml.tag!('domain:registrant', @domain.registrant_code)
xml.tag!('domain:registrant', @domain.registrant.code)
@domain.tech_contacts.each do |tc|
xml.tag!('domain:contact', tc.code, 'type' => 'tech')

View file

@ -1,6 +1,6 @@
Tere
<br><br>
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant.name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
<br><br>
Lugupidamisega<br>
Eesti Interneti Sihtasutus
@ -9,7 +9,7 @@ Eesti Interneti Sihtasutus
<br><br>
Hi,
<br><br>
Domain <%= @domain.name %> deletion was not approved in time by the registrant <%= @domain.registrant_name %>. Thus the deletion of domain <%= @domain.name %> is cancelled.
Domain <%= @domain.name %> deletion was not approved in time by the registrant <%= @domain.registrant.name %>. Thus the deletion of domain <%= @domain.name %> is cancelled.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -1,6 +1,6 @@
Tere
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant_name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
Domeeni <%= @domain.name %> kustutamise taotlust ei kinnitatud tähtaegselt registreerija <%= @domain.registrant.name %> poolt. Domeeni <%= @domain.name %> kustutamine on sellest tulenevalt tühistatud.
Lugupidamisega
Eesti Interneti Sihtasutus
@ -9,7 +9,7 @@ Eesti Interneti Sihtasutus
Hi,
Domain <%= @domain.name %> deletion was not approved in time by the registrant <%= @domain.registrant_name %>. Thus the deletion of domain <%= @domain.name %> is cancelled.
Domain <%= @domain.name %> deletion was not approved in time by the registrant <%= @domain.registrant.name %>. Thus the deletion of domain <%= @domain.name %> is cancelled.
Best Regards,
Estonian Internet Foundation

View file

@ -1,6 +1,6 @@
Tere
<br><br>
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrant_name %> poolt tagasi lükatud.
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrant.name %> poolt tagasi lükatud.
<br><br>
Lugupidamisega<br>
Eesti Interneti Sihtasutus
@ -9,7 +9,7 @@ Eesti Interneti Sihtasutus
<br><br>
Hi,
<br><br>
Domain <%= @domain.name %> deletion was rejected by the registrant <%= @domain.registrant_name %>.
Domain <%= @domain.name %> deletion was rejected by the registrant <%= @domain.registrant.name %>.
<br><br>
Best Regards,<br>
Estonian Internet Foundation

View file

@ -1,6 +1,6 @@
Tere
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrant_name %> poolt tagasi lükatud.
Domeeni <%= @domain.name %> kustutamise taotlus on registreerija <%= @domain.registrant.name %> poolt tagasi lükatud.
Lugupidamisega
Eesti Interneti Sihtasutus
@ -9,7 +9,7 @@ Eesti Interneti Sihtasutus
Hi,
Domain <%= @domain.name %> deletion was rejected by the registrant <%= @domain.registrant_name %>.
Domain <%= @domain.name %> deletion was rejected by the registrant <%= @domain.registrant.name %>.
Best Regards,
Estonian Internet Foundation

View file

@ -29,7 +29,7 @@
%p= t('.registrant') + ':'
.column-values
%p= @domain.name
%p= "#{@domain.registrant_name} (#{@domain.registrant.ident})"
%p= "#{@domain.registrant.name} (#{@domain.registrant.ident})"
.row
.col-md-12.text-center

View file

@ -30,7 +30,7 @@
%p= t(:new_pending_registrant) + ':'
.column-values
%p= @domain.name
%p= "#{@domain.registrant_name} (#{@domain.registrant.ident})"
%p= "#{@domain.registrant.name} (#{@domain.registrant.ident})"
%p= "#{@domain.pending_registrant.try(:name)} (#{@domain.pending_registrant.try(:ident)})"
.row

View file

@ -81,9 +81,8 @@ RSpec.describe DomainPresenter do
domain_delegatable_attributes = %i(
name
transfer_code
registrant_name
registrant
registrant_id
registrant_code
)
domain_delegatable_attributes.each do |attribute_name|

View file

@ -46,7 +46,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'keeps same registrant' do
expect { request; domain.reload }.to_not change { domain.registrant_code }
expect { request; domain.reload }.to_not change { domain.registrant.code }
end
it 'does not ask for confirmation' do
@ -91,7 +91,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'does not change registrant without confirmation' do
expect { request; domain.reload }.to_not change { domain.registrant_code }
expect { request; domain.reload }.to_not change { domain.registrant.code }
end
it 'asks for confirmation' do
@ -147,7 +147,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'keeps same registrant' do
expect { request; domain.reload }.to_not change { domain.registrant_code }
expect { request; domain.reload }.to_not change { domain.registrant.code }
end
it 'does not ask for confirmation' do
@ -192,7 +192,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'changes registrant without confirmation' do
expect { request; domain.reload }.to change { domain.registrant_code }.from('OLD-CODE').to('NEW-CODE')
expect { request; domain.reload }.to change { domain.registrant.code }.from('OLD-CODE').to('NEW-CODE')
end
it 'does not ask for confirmation' do

View file

@ -47,7 +47,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'changes registrant' do
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
expect { request; domain.reload }.to change { domain.registrant.code }.from('old-code').to('new-code')
end
it 'does not send confirmation email' do
@ -90,7 +90,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'does not change registrant' do
expect { request; domain.reload }.to_not change { domain.registrant_code }
expect { request; domain.reload }.to_not change { domain.registrant.code }
end
it 'sends confirmation and notice emails' do
@ -139,7 +139,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'changes registrant' do
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
expect { request; domain.reload }.to change { domain.registrant.code }.from('old-code').to('new-code')
end
it 'does not send confirmation email' do
@ -182,7 +182,7 @@ RSpec.describe 'EPP domain:update' do
end
it 'changes registrant' do
expect { request; domain.reload }.to change { domain.registrant_code }.from('old-code').to('new-code')
expect { request; domain.reload }.to change { domain.registrant.code }.from('old-code').to('new-code')
end
it 'does not send confirmation email' do