mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
Merge pull request #113 from internetee/story/115405945-clean_expired_pendings
Story/115405945 clean expired pendings
This commit is contained in:
commit
53fae3d535
1 changed files with 16 additions and 4 deletions
|
@ -345,7 +345,8 @@ class Domain < ActiveRecord::Base
|
|||
end
|
||||
|
||||
|
||||
# state change shouln't be
|
||||
# state changes may be done low-level - no validation
|
||||
# in this metod we still save PaperTrail log.
|
||||
def clean_pendings_lowlevel
|
||||
statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION)
|
||||
statuses.delete(DomainStatus::PENDING_UPDATE)
|
||||
|
@ -354,13 +355,23 @@ class Domain < ActiveRecord::Base
|
|||
status_notes[DomainStatus::PENDING_UPDATE] = ''
|
||||
status_notes[DomainStatus::PENDING_DELETE] = ''
|
||||
|
||||
update_columns(
|
||||
hash = {
|
||||
registrant_verification_token: nil,
|
||||
registrant_verification_asked_at: nil,
|
||||
pending_json: {},
|
||||
status_notes: status_notes,
|
||||
statuses: statuses.presence || [DomainStatus::OK]
|
||||
)
|
||||
statuses: statuses.presence || [DomainStatus::OK],
|
||||
# need this column in order to update PaperTrail version properly
|
||||
updated_at: Time.now.utc
|
||||
}
|
||||
|
||||
# PaperTrail
|
||||
self.attributes = hash
|
||||
record_update
|
||||
clear_version_instance!
|
||||
reset_transaction_id
|
||||
|
||||
update_columns(hash)
|
||||
end
|
||||
|
||||
def pending_update!
|
||||
|
@ -384,6 +395,7 @@ class Domain < ActiveRecord::Base
|
|||
self.registrant_verification_token = token
|
||||
self.registrant_verification_asked_at = asked_at
|
||||
set_pending_update
|
||||
touch_always_version
|
||||
pending_json['new_registrant_id'] = new_registrant_id
|
||||
pending_json['new_registrant_email'] = new_registrant_email
|
||||
pending_json['new_registrant_name'] = new_registrant_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue