mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Update automatic statuses for domain pending #2731
This commit is contained in:
parent
a784eb4769
commit
19f61dd30f
1 changed files with 14 additions and 7 deletions
|
@ -62,19 +62,20 @@ class Domain < ActiveRecord::Base
|
|||
before_create :generate_auth_info
|
||||
before_create :set_validity_dates
|
||||
before_create -> { self.reserved = in_reserved_list?; nil }
|
||||
before_update :manage_statuses
|
||||
def manage_statuses
|
||||
return unless registrant_id_changed?
|
||||
pending_update! if registrant_verification_asked?
|
||||
true
|
||||
end
|
||||
|
||||
before_save :manage_automatic_statuses
|
||||
|
||||
before_save :touch_always_version
|
||||
def touch_always_version
|
||||
self.updated_at = Time.zone.now
|
||||
end
|
||||
|
||||
before_update :manage_statuses
|
||||
def manage_statuses
|
||||
return unless registrant_id_changed? # rollback has not yet happened
|
||||
pending_update! if registrant_verification_asked?
|
||||
true
|
||||
end
|
||||
|
||||
after_save :update_whois_record
|
||||
|
||||
after_create :update_reserved_domains
|
||||
|
@ -379,6 +380,12 @@ class Domain < ActiveRecord::Base
|
|||
pending_json[:new_registrant_id] = new_registrant_id
|
||||
pending_json[:new_registrant_email] = new_registrant_email
|
||||
pending_json[:new_registrant_name] = new_registrant_name
|
||||
|
||||
# This pending_update! method is triggered by before_update
|
||||
# Note, all before_save callbacks are excecuted before before_update,
|
||||
# thus automatic statuses has already excectued by this point
|
||||
# and we need to trigger automatic statuses manually (second time).
|
||||
manage_automatic_statuses
|
||||
end
|
||||
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue