diff --git a/app/models/whois_record.rb b/app/models/whois_record.rb index 0e7ed3f30..e1b168935 100644 --- a/app/models/whois_record.rb +++ b/app/models/whois_record.rb @@ -20,11 +20,11 @@ class WhoisRecord < ActiveRecord::Base includes( domain: [ :registrant, - :registrar, - :nameservers, + :registrar, + :nameservers, { tech_contacts: :registrar }, { admin_contacts: :registrar } - ] + ] ) end end @@ -34,19 +34,23 @@ class WhoisRecord < ActiveRecord::Base h = HashWithIndifferentAccess.new return h if domain.blank? + status_map = { + 'ok' => 'ok (paid and in zone)' + } + @disclosed = [] h[:name] = domain.name h[:registrant] = domain.registrant.name - h[:status] = domain.domain_statuses.map(&:human_value).join(', ') + h[:status] = domain.statuses.map { |x| status_map[x] || x }.join(', ') h[:registered] = domain.registered_at.try(:to_s, :iso8601) h[:updated_at] = domain.updated_at.try(:to_s, :iso8601) h[:valid_to] = domain.valid_to.try(:to_s, :iso8601) - + # update registar triggers when adding new attributes h[:registrar] = domain.registrar.name h[:registrar_phone] = domain.registrar.phone h[:registrar_address] = domain.registrar.address - h[:registrar_update_at] = domain.registrar.updated_at.try(:to_s, :iso8601) + h[:registrar_update_at] = domain.registrar.updated_at.try(:to_s, :iso8601) h[:admin_contacts] = [] domain.admin_contacts.each do |ac| diff --git a/spec/features/registrant/domain_delete_confirm_spec.rb b/spec/features/registrant/domain_delete_confirm_spec.rb index 6ca4bad2e..23697d9d1 100644 --- a/spec/features/registrant/domain_delete_confirm_spec.rb +++ b/spec/features/registrant/domain_delete_confirm_spec.rb @@ -22,11 +22,11 @@ feature 'DomainDeleteConfirm', type: :feature do context 'as unknown user with domain with token' do before :all do @domain = Fabricate( - :domain, - registrant_verification_token: '123', + :domain, + registrant_verification_token: '123', registrant_verification_asked_at: Time.zone.now ) - @domain.domain_statuses.create(value: DomainStatus::PENDING_DELETE) + @domain.statuses << DomainStatus::PENDING_DELETE end it 'should see warning info if token is missing in request' do diff --git a/spec/features/registrant/domain_update_confirm_spec.rb b/spec/features/registrant/domain_update_confirm_spec.rb index 5d5a298f7..fc69bfb0f 100644 --- a/spec/features/registrant/domain_update_confirm_spec.rb +++ b/spec/features/registrant/domain_update_confirm_spec.rb @@ -22,11 +22,11 @@ feature 'DomainUpdateConfirm', type: :feature do context 'as unknown user with domain with update token' do before :all do @domain = Fabricate( - :domain, - registrant_verification_token: '123', + :domain, + registrant_verification_token: '123', registrant_verification_asked_at: Time.zone.now ) - @domain.domain_statuses.create(value: DomainStatus::PENDING_UPDATE) + @domain.statuses << DomainStatus::PENDING_UPDATE end it 'should see warning info if token is missing in request' do