mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
Merge branch 'story/113066359-optimization' into staging
# Conflicts: # app/jobs/regenerate_registrar_whoises_job.rb # app/jobs/regenerate_whois_record_job.rb # app/models/blocked_domain.rb
This commit is contained in:
commit
af28b9e3f2
7 changed files with 82 additions and 64 deletions
|
@ -45,7 +45,7 @@ class Domain < ActiveRecord::Base
|
|||
has_many :dnskeys, dependent: :destroy
|
||||
|
||||
has_many :keyrelays
|
||||
has_one :whois_record, dependent: :destroy
|
||||
has_one :whois_record # destroyment will be done in after_commit
|
||||
|
||||
accepts_nested_attributes_for :dnskeys, allow_destroy: true
|
||||
|
||||
|
@ -89,14 +89,11 @@ class Domain < ActiveRecord::Base
|
|||
true
|
||||
end
|
||||
|
||||
after_save :update_whois_record
|
||||
after_commit :update_whois_record
|
||||
|
||||
after_create :update_reserved_domains
|
||||
def update_reserved_domains
|
||||
return unless in_reserved_list?
|
||||
rd = ReservedDomain.by_domain(name).first
|
||||
rd.password = SecureRandom.hex
|
||||
rd.save
|
||||
ReservedDomain.new_password_for(name) if in_reserved_list?
|
||||
end
|
||||
|
||||
validates :name_dirty, domain_name: true, uniqueness: true
|
||||
|
@ -286,7 +283,7 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def in_reserved_list?
|
||||
ReservedDomain.pw_for(name).present?
|
||||
@in_reserved_list ||= ReservedDomain.by_domain(name).any?
|
||||
end
|
||||
|
||||
def pending_transfer
|
||||
|
@ -758,7 +755,7 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def update_whois_record
|
||||
whois_record.blank? ? create_whois_record : whois_record.save
|
||||
UpdateWhoisRecordJob.enqueue name, 'domain'
|
||||
end
|
||||
|
||||
def status_notes_array=(notes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue