mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Merge branch 'master' into registry-662
This commit is contained in:
commit
72dcb24e3e
24 changed files with 201 additions and 155 deletions
|
@ -5,6 +5,11 @@ module Concerns::Domain::Deletable
|
|||
alias_attribute :delete_time, :delete_at
|
||||
end
|
||||
|
||||
def discard
|
||||
statuses << DomainStatus::DELETE_CANDIDATE
|
||||
save
|
||||
end
|
||||
|
||||
def discarded?
|
||||
statuses.include?(DomainStatus::DELETE_CANDIDATE)
|
||||
end
|
||||
|
|
|
@ -23,6 +23,12 @@ class WhoisRecord < ActiveRecord::Base
|
|||
h = HashWithIndifferentAccess.new
|
||||
return h if domain.blank?
|
||||
|
||||
if domain.discarded?
|
||||
h[:name] = domain.name
|
||||
h[:status] = ['deleteCandidate']
|
||||
return h
|
||||
end
|
||||
|
||||
status_map = {
|
||||
'ok' => 'ok (paid and in zone)'
|
||||
}
|
||||
|
@ -34,7 +40,7 @@ class WhoisRecord < ActiveRecord::Base
|
|||
h[:status] = domain.statuses.map { |x| status_map[x] || x }
|
||||
h[:registered] = domain.registered_at.try(:to_s, :iso8601)
|
||||
h[:changed] = domain.updated_at.try(:to_s, :iso8601)
|
||||
h[:expire] = domain.valid_to.try(:to_date).try(:to_s)
|
||||
h[:expire] = domain.valid_to.to_date.to_s
|
||||
h[:outzone] = domain.outzone_at.try(:to_date).try(:to_s)
|
||||
h[:delete] = [domain.delete_at, domain.force_delete_at].compact.min.try(:to_date).try(:to_s)
|
||||
|
||||
|
@ -88,7 +94,8 @@ class WhoisRecord < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def generated_body
|
||||
template = Rails.root.join("app/views/for_models/whois.erb".freeze)
|
||||
template_name = domain.discarded? ? 'whois_discarded.erb' : 'whois.erb'
|
||||
template = Rails.root.join("app/views/for_models/#{template_name}".freeze)
|
||||
ERB.new(template.read, nil, "-").result(binding)
|
||||
end
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue