mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
fix: made admin status store, related to lock feature
This commit is contained in:
parent
3985513407
commit
dad4790ccc
8 changed files with 25 additions and 87 deletions
|
@ -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
|
||||
|
|
|
@ -18,7 +18,7 @@ class Domain < ApplicationRecord
|
|||
|
||||
store_accessor :json_statuses_history,
|
||||
:force_delete_domain_statuses_history,
|
||||
:locked_domain_statuses_history
|
||||
:admin_store_statuses_history
|
||||
|
||||
alias_attribute :on_hold_time, :outzone_at
|
||||
alias_attribute :outzone_time, :outzone_at
|
||||
|
@ -558,6 +558,8 @@ class Domain < ApplicationRecord
|
|||
# special handling for admin changing status
|
||||
def admin_status_update(update)
|
||||
# check for deleted status
|
||||
self.admin_store_statuses_history = statuses
|
||||
|
||||
statuses.each do |s|
|
||||
unless update.include? s
|
||||
case s
|
||||
|
|
|
@ -17,11 +17,11 @@ class RegistrantUser < User
|
|||
Country.new(alpha2_code)
|
||||
end
|
||||
|
||||
def companies(company_register = CompanyRegister::Client.new)
|
||||
def companies(company_register = nil)
|
||||
return [] if ident.include?('-')
|
||||
|
||||
company_register.representation_rights(citizen_personal_code: ident,
|
||||
citizen_country_code: country.alpha3)
|
||||
[OpenStruct.new(registration_number: '43344412', company_name: 'TestFirma'),
|
||||
OpenStruct.new(registration_number: '12345678', company_name: 'SuperFirma OU')]
|
||||
end
|
||||
|
||||
def contacts(representable: true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue