mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 12:17:30 +02:00
updated restore function
This commit is contained in:
parent
f65063f6a5
commit
6a050f9ce3
5 changed files with 14 additions and 6 deletions
|
@ -10,6 +10,7 @@ module Domains
|
||||||
DomainStatus::SERVER_OBJ_UPDATE_PROHIBITED,
|
DomainStatus::SERVER_OBJ_UPDATE_PROHIBITED,
|
||||||
DomainStatus::SERVER_DELETE_PROHIBITED
|
DomainStatus::SERVER_DELETE_PROHIBITED
|
||||||
] if domain.locked_by_registrant?
|
] if domain.locked_by_registrant?
|
||||||
|
|
||||||
domain.admin_store_statuses_history -= domain_statuses unless domain.admin_store_statuses_history.nil?
|
domain.admin_store_statuses_history -= domain_statuses unless domain.admin_store_statuses_history.nil?
|
||||||
rejected_statuses = domain.statuses.reject { |a| domain_statuses.include? a }
|
rejected_statuses = domain.statuses.reject { |a| domain_statuses.include? a }
|
||||||
domain.statuses = rejected_statuses
|
domain.statuses = rejected_statuses
|
||||||
|
|
|
@ -11,7 +11,6 @@ module Domains
|
||||||
|
|
||||||
# Allow deletion
|
# Allow deletion
|
||||||
statuses.delete(DomainStatus::CLIENT_DELETE_PROHIBITED)
|
statuses.delete(DomainStatus::CLIENT_DELETE_PROHIBITED)
|
||||||
# statuses.delete(DomainStatus::SERVER_DELETE_PROHIBITED)
|
|
||||||
domain.save(validate: false)
|
domain.save(validate: false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,14 +53,23 @@ module Domain::RegistryLockable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def restore_statuses_if_domain_had_fd
|
||||||
|
self.statuses = self.statuses | Domain::FORCE_DELETE_STATUSES
|
||||||
|
|
||||||
|
save!
|
||||||
|
end
|
||||||
|
|
||||||
def remove_statuses_from_locked_domain
|
def remove_statuses_from_locked_domain
|
||||||
|
fd_flag = force_delete_scheduled?
|
||||||
LOCK_STATUSES.each do |domain_status|
|
LOCK_STATUSES.each do |domain_status|
|
||||||
statuses.delete([domain_status])
|
statuses.delete([domain_status])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.force_delete_domain_statuses_history -= LOCK_STATUSES if force_delete_domain_statuses_history.present?
|
||||||
statuses.delete([EXTENSIONS_STATUS]) if statuses.include? EXTENSIONS_STATUS
|
statuses.delete([EXTENSIONS_STATUS]) if statuses.include? EXTENSIONS_STATUS
|
||||||
self.locked_by_registrant_at = nil
|
self.locked_by_registrant_at = nil
|
||||||
self.statuses = admin_store_statuses_history || []
|
self.statuses = admin_store_statuses_history || []
|
||||||
|
self.statuses = self.statuses | Domain::FORCE_DELETE_STATUSES if fd_flag
|
||||||
alert_registrar_lock_changes!(lock: false)
|
alert_registrar_lock_changes!(lock: false)
|
||||||
|
|
||||||
save!
|
save!
|
||||||
|
|
|
@ -17,11 +17,11 @@ class RegistrantUser < User
|
||||||
Country.new(alpha2_code)
|
Country.new(alpha2_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
def companies(company_register = nil)
|
def companies(company_register = CompanyRegister::Client.new)
|
||||||
return [] if ident.include?('-')
|
return [] if ident.include?('-')
|
||||||
|
|
||||||
[OpenStruct.new(registration_number: '43344412', company_name: 'TestFirma'),
|
company_register.representation_rights(citizen_personal_code: ident,
|
||||||
OpenStruct.new(registration_number: '12345678', company_name: 'SuperFirma OU')]
|
citizen_country_code: country.alpha3)
|
||||||
end
|
end
|
||||||
|
|
||||||
def contacts(representable: true)
|
def contacts(representable: true)
|
||||||
|
|
|
@ -102,8 +102,7 @@ class ForceDeleteTest < ActionMailer::TestCase
|
||||||
|
|
||||||
def test_scheduling_force_delete_allows_domain_deletion
|
def test_scheduling_force_delete_allows_domain_deletion
|
||||||
statuses_to_be_removed = [
|
statuses_to_be_removed = [
|
||||||
DomainStatus::CLIENT_DELETE_PROHIBITED,
|
DomainStatus::CLIENT_DELETE_PROHIBITED
|
||||||
DomainStatus::SERVER_DELETE_PROHIBITED
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@domain.statuses = statuses_to_be_removed + %w[other-status]
|
@domain.statuses = statuses_to_be_removed + %w[other-status]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue