mirror of
https://github.com/internetee/registry.git
synced 2025-07-13 22:45:06 +02:00
Merge branch 'master' into domains-nested-refactor
Conflicts: config/locales/en.yml
This commit is contained in:
commit
08fb2966d4
93 changed files with 2356 additions and 1678 deletions
|
@ -20,8 +20,6 @@ class Domain < ActiveRecord::Base
|
|||
-> { where(domain_contacts: { contact_type: DomainContact::ADMIN }) },
|
||||
through: :domain_contacts, source: :contact
|
||||
|
||||
# TODO: remove old
|
||||
# has_many :nameservers, dependent: :delete_all, after_add: :track_nameserver_add
|
||||
has_many :nameservers, dependent: :delete_all
|
||||
|
||||
accepts_nested_attributes_for :nameservers, allow_destroy: true,
|
||||
|
@ -43,11 +41,11 @@ class Domain < ActiveRecord::Base
|
|||
has_many :legal_documents, as: :documentable
|
||||
accepts_nested_attributes_for :legal_documents, reject_if: proc { |attrs| attrs[:body].blank? }
|
||||
|
||||
delegate :code, to: :owner_contact, prefix: true
|
||||
delegate :code, to: :owner_contact, prefix: true
|
||||
delegate :email, to: :owner_contact, prefix: true
|
||||
delegate :ident, to: :owner_contact, prefix: true
|
||||
delegate :phone, to: :owner_contact, prefix: true
|
||||
delegate :name, to: :registrar, prefix: true
|
||||
delegate :name, to: :registrar, prefix: true
|
||||
|
||||
before_create :generate_auth_info
|
||||
before_create :set_validity_dates
|
||||
|
@ -118,11 +116,6 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
attr_accessor :owner_contact_typeahead, :update_me
|
||||
|
||||
# TODO: remove old
|
||||
# archiving
|
||||
# if proc works only on changes on domain sadly
|
||||
# has_paper_trail class_name: 'DomainVersion', meta: { snapshot: :create_snapshot }, if: proc(&:new_version)
|
||||
|
||||
def tech_domain_contacts
|
||||
domain_contacts.select { |x| x.contact_type == DomainContact::TECH }
|
||||
end
|
||||
|
@ -131,52 +124,6 @@ class Domain < ActiveRecord::Base
|
|||
domain_contacts.select { |x| x.contact_type == DomainContact::ADMIN }
|
||||
end
|
||||
|
||||
# TODO: remove old
|
||||
# def new_version
|
||||
# return false if versions.try(:last).try(:snapshot) == create_snapshot
|
||||
# true
|
||||
# end
|
||||
|
||||
# TODO: remove old
|
||||
# def create_version
|
||||
# return true unless PaperTrail.enabled?
|
||||
# return true unless valid?
|
||||
# touch_with_version if new_version
|
||||
# end
|
||||
|
||||
# TODO: remove old
|
||||
# def track_nameserver_add(_nameserver)
|
||||
# return true if versions.count == 0
|
||||
# return true unless valid? && new_version
|
||||
|
||||
# touch_with_version
|
||||
# end
|
||||
|
||||
# TODO: remove old
|
||||
# def create_snapshot
|
||||
# oc = owner_contact.snapshot if owner_contact.is_a?(Contact)
|
||||
# {
|
||||
# owner_contact: oc,
|
||||
# tech_contacts: tech_contacts.map(&:snapshot),
|
||||
# admin_contacts: admin_contacts.map(&:snapshot),
|
||||
# nameservers: nameservers.map(&:snapshot),
|
||||
# domain: make_snapshot
|
||||
# }.to_yaml
|
||||
# end
|
||||
|
||||
# TODO: remove old
|
||||
# def make_snapshot
|
||||
# {
|
||||
# name: name,
|
||||
# status: status,
|
||||
# period: period,
|
||||
# period_unit: period_unit,
|
||||
# registrar_id: registrar.try(:id),
|
||||
# valid_to: valid_to,
|
||||
# valid_from: valid_from
|
||||
# }
|
||||
# end
|
||||
|
||||
def name=(value)
|
||||
value.strip!
|
||||
value.downcase!
|
||||
|
@ -265,7 +212,7 @@ class Domain < ActiveRecord::Base
|
|||
attach_contact(DomainContact::TECH, owner_contact)
|
||||
end
|
||||
|
||||
return unless admin_domain_contacts.count.zero? && owner_contact.citizen?
|
||||
return unless admin_domain_contacts.count.zero? && owner_contact.priv?
|
||||
attach_contact(DomainContact::ADMIN, owner_contact)
|
||||
end
|
||||
|
||||
|
@ -305,36 +252,36 @@ class Domain < ActiveRecord::Base
|
|||
# rubocop:disable Metrics/MethodLength
|
||||
def update_whois_body
|
||||
self.whois_body = <<-EOS
|
||||
This Whois Server contains information on
|
||||
Estonian Top Level Domain ee TLD
|
||||
This Whois Server contains information on
|
||||
Estonian Top Level Domain ee TLD
|
||||
|
||||
domain: #{name}
|
||||
registrar: #{registrar}
|
||||
status:
|
||||
registered:
|
||||
changed: #{updated_at.to_s(:db)}
|
||||
expire:
|
||||
outzone:
|
||||
delete:
|
||||
domain: #{name}
|
||||
registrar: #{registrar}
|
||||
status:
|
||||
registered:
|
||||
changed: #{updated_at.to_s(:db)}
|
||||
expire:
|
||||
outzone:
|
||||
delete:
|
||||
|
||||
contact
|
||||
name:
|
||||
e-mail:
|
||||
registrar:
|
||||
created:
|
||||
contact
|
||||
name:
|
||||
e-mail:
|
||||
registrar:
|
||||
created:
|
||||
|
||||
contact:
|
||||
contact:
|
||||
|
||||
nsset:
|
||||
nserver:
|
||||
nsset:
|
||||
nserver:
|
||||
|
||||
registrar:
|
||||
org:
|
||||
url:
|
||||
phone:
|
||||
address:
|
||||
created:
|
||||
changed:
|
||||
registrar:
|
||||
org:
|
||||
url:
|
||||
phone:
|
||||
address:
|
||||
created:
|
||||
changed:
|
||||
EOS
|
||||
end
|
||||
# rubocop:enabled Metrics/MethodLength
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue