fix: made admin status store, related to lock feature

This commit is contained in:
Oleg Hasjanov 2021-04-07 14:46:40 +03:00
parent 3985513407
commit dad4790ccc
8 changed files with 25 additions and 87 deletions

View file

@ -9,18 +9,13 @@ module Domain::RegistryLockable
return unless registry_lockable?
return if locked_by_registrant?
save_statuses_history
transaction do
self.statuses |= LOCK_STATUSES
self.locked_by_registrant_at = Time.zone.now
alert_registrar_lock_changes!(lock: true)
# transaction do
# self.statuses |= LOCK_STATUSES
# self.locked_by_registrant_at = Time.zone.now
# alert_registrar_lock_changes!(lock: true)
# save!
# end
# Domains::ForceDelete::SetForceDelete.run(domain: self, type: type, reason: reason,
# notify_by_email: notify_by_email, email: email)
Domain::RegistryLockable::SetRegistratLock.run(domain: self)
save!
end
end
def registry_lockable?
@ -41,10 +36,10 @@ module Domain::RegistryLockable
transaction do
LOCK_STATUSES.each do |domain_status|
remove_predetermined_statuses domain_status
statuses.delete([domain_status])
end
self.locked_by_registrant_at = nil
clear_locked_domain_statuses_history
self.statuses = admin_store_statuses_history || []
alert_registrar_lock_changes!(lock: false)
save!
@ -62,18 +57,4 @@ module Domain::RegistryLockable
end
private
def save_statuses_history
self.locked_domain_statuses_history = statuses.map do |status|
status if LOCK_STATUSES.include? status
end
end
def remove_predetermined_statuses(domain_status)
statuses.delete(domain_status) unless locked_domain_statuses_history.include? domain_status
end
def clear_locked_domain_statuses_history
self.locked_domain_statuses_history = nil
end
end