mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 14:44:47 +02:00
Merge pull request #1902 from internetee/1900-removing-registry-lock-should-not-remove-statuses-set-prior-to-setting-it
implement domain statuses restore after domain locked, added test
This commit is contained in:
commit
f6fcf15fff
14 changed files with 171 additions and 10 deletions
|
@ -1,6 +1,10 @@
|
|||
module Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
FORCE_DELETE_STATUSES = [DomainStatus::FORCE_DELETE,
|
||||
DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze
|
||||
|
||||
included do
|
||||
store_accessor :force_delete_data,
|
||||
:force_delete_type,
|
||||
|
@ -52,6 +56,7 @@ module Domain::ForceDelete # rubocop:disable Metrics/ModuleLength
|
|||
|
||||
def cancel_force_delete
|
||||
Domains::CancelForceDelete::CancelForceDelete.run(domain: self)
|
||||
# self.statuses = force_delete_domain_statuses_history
|
||||
end
|
||||
|
||||
def outzone_date
|
||||
|
|
|
@ -36,9 +36,10 @@ module Domain::RegistryLockable
|
|||
|
||||
transaction do
|
||||
LOCK_STATUSES.each do |domain_status|
|
||||
statuses.delete(domain_status)
|
||||
statuses.delete([domain_status])
|
||||
end
|
||||
self.locked_by_registrant_at = nil
|
||||
self.statuses = admin_store_statuses_history || []
|
||||
alert_registrar_lock_changes!(lock: false)
|
||||
|
||||
save!
|
||||
|
|
|
@ -12,10 +12,18 @@ class Domain < ApplicationRecord
|
|||
include Domain::Disputable
|
||||
include Domain::BulkUpdatable
|
||||
|
||||
LOCK_STATUSES = [DomainStatus::SERVER_UPDATE_PROHIBITED,
|
||||
DomainStatus::SERVER_DELETE_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED].freeze
|
||||
|
||||
attr_accessor :roles
|
||||
|
||||
attr_accessor :legal_document_id
|
||||
|
||||
store_accessor :json_statuses_history,
|
||||
:force_delete_domain_statuses_history,
|
||||
:admin_store_statuses_history
|
||||
|
||||
alias_attribute :on_hold_time, :outzone_at
|
||||
alias_attribute :outzone_time, :outzone_at
|
||||
alias_attribute :auth_info, :transfer_code # Old attribute name; for PaperTrail
|
||||
|
@ -551,8 +559,23 @@ class Domain < ApplicationRecord
|
|||
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
|
||||
def update_unless_locked_by_registrant(update)
|
||||
update(admin_store_statuses_history: update) unless locked_by_registrant?
|
||||
end
|
||||
|
||||
def update_not_by_locked_statuses(update)
|
||||
return unless locked_by_registrant?
|
||||
|
||||
result = update.reject { |status| LOCK_STATUSES.include? status }
|
||||
update(admin_store_statuses_history: result)
|
||||
end
|
||||
|
||||
# special handling for admin changing status
|
||||
def admin_status_update(update)
|
||||
update_unless_locked_by_registrant(update)
|
||||
|
||||
update_not_by_locked_statuses(update)
|
||||
|
||||
# check for deleted status
|
||||
statuses.each do |s|
|
||||
unless update.include? s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue