mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 04:37:30 +02:00
Did small refactoring
This commit is contained in:
parent
1f4733bdde
commit
c83b99b6de
2 changed files with 14 additions and 8 deletions
|
@ -469,6 +469,7 @@ class Domain < ApplicationRecord
|
||||||
return false unless pending_update?
|
return false unless pending_update?
|
||||||
return false unless registrant_verification_asked?
|
return false unless registrant_verification_asked?
|
||||||
return false unless registrant_verification_token == token
|
return false unless registrant_verification_token == token
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -476,6 +477,7 @@ class Domain < ApplicationRecord
|
||||||
return false unless pending_delete?
|
return false unless pending_delete?
|
||||||
return false unless registrant_verification_asked?
|
return false unless registrant_verification_asked?
|
||||||
return false unless registrant_verification_token == token
|
return false unless registrant_verification_token == token
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -492,10 +494,12 @@ class Domain < ApplicationRecord
|
||||||
|
|
||||||
def pending_delete!
|
def pending_delete!
|
||||||
return true if pending_delete?
|
return true if pending_delete?
|
||||||
|
|
||||||
self.epp_pending_delete = true # for epp
|
self.epp_pending_delete = true # for epp
|
||||||
|
|
||||||
# TODO: if this were to ever return true, that would be wrong. EPP would report sucess pending
|
# TODO: if this were to ever return true, that would be wrong. EPP would report sucess pending
|
||||||
return true unless registrant_verification_asked?
|
return true unless registrant_verification_asked?
|
||||||
|
|
||||||
pending_delete_confirmation!
|
pending_delete_confirmation!
|
||||||
save(validate: false) # should check if this did succeed
|
save(validate: false) # should check if this did succeed
|
||||||
|
|
||||||
|
@ -560,6 +564,7 @@ class Domain < ApplicationRecord
|
||||||
def pending_registrant
|
def pending_registrant
|
||||||
return '' if pending_json.blank?
|
return '' if pending_json.blank?
|
||||||
return '' if pending_json['new_registrant_id'].blank?
|
return '' if pending_json['new_registrant_id'].blank?
|
||||||
|
|
||||||
Registrant.find_by(id: pending_json['new_registrant_id'])
|
Registrant.find_by(id: pending_json['new_registrant_id'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -590,11 +595,12 @@ class Domain < ApplicationRecord
|
||||||
|
|
||||||
# special handling for admin changing status
|
# special handling for admin changing status
|
||||||
def admin_status_update(update)
|
def admin_status_update(update)
|
||||||
|
return unless update
|
||||||
|
|
||||||
PaperTrail.request(enabled: false) do
|
PaperTrail.request(enabled: false) do
|
||||||
update_unless_locked_by_registrant(update)
|
update_unless_locked_by_registrant(update)
|
||||||
update_not_by_locked_statuses(update)
|
update_not_by_locked_statuses(update)
|
||||||
end
|
end
|
||||||
return unless update
|
|
||||||
|
|
||||||
# check for deleted status
|
# check for deleted status
|
||||||
statuses.each do |s|
|
statuses.each do |s|
|
||||||
|
@ -660,7 +666,7 @@ class Domain < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def manage_automatic_statuses
|
def manage_automatic_statuses
|
||||||
if !self.class.nameserver_required?
|
unless self.class.nameserver_required?
|
||||||
deactivate if nameservers.reject(&:marked_for_destruction?).empty?
|
deactivate if nameservers.reject(&:marked_for_destruction?).empty?
|
||||||
activate if nameservers.reject(&:marked_for_destruction?).size >= Setting.ns_min_count
|
activate if nameservers.reject(&:marked_for_destruction?).size >= Setting.ns_min_count
|
||||||
end
|
end
|
||||||
|
@ -681,11 +687,11 @@ class Domain < ApplicationRecord
|
||||||
def children_log
|
def children_log
|
||||||
log = HashWithIndifferentAccess.new
|
log = HashWithIndifferentAccess.new
|
||||||
log[:admin_contacts] = admin_contact_ids
|
log[:admin_contacts] = admin_contact_ids
|
||||||
log[:tech_contacts] = tech_contact_ids
|
log[:tech_contacts] = tech_contact_ids
|
||||||
log[:nameservers] = nameserver_ids
|
log[:nameservers] = nameserver_ids
|
||||||
log[:dnskeys] = dnskey_ids
|
log[:dnskeys] = dnskey_ids
|
||||||
log[:legal_documents]= [legal_document_id]
|
log[:legal_documents] = [legal_document_id]
|
||||||
log[:registrant] = [registrant_id]
|
log[:registrant] = [registrant_id]
|
||||||
log
|
log
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class RegistrantChangeMailerTest < ActionMailer::TestCase
|
||||||
registrar: @domain.registrar,
|
registrar: @domain.registrar,
|
||||||
current_registrant: @domain.registrant,
|
current_registrant: @domain.registrant,
|
||||||
new_registrant: @domain.registrant)
|
new_registrant: @domain.registrant)
|
||||||
.deliver_now
|
.deliver_now
|
||||||
|
|
||||||
assert_emails 1
|
assert_emails 1
|
||||||
assert_equal ['john@inbox.test'], email.to
|
assert_equal ['john@inbox.test'], email.to
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue