mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 12:17:30 +02:00
fixed storing lockable statuses
This commit is contained in:
parent
9c0018d6fe
commit
3f8a99d8ca
3 changed files with 11 additions and 3 deletions
|
@ -53,9 +53,8 @@ module Admin
|
|||
dp = ignore_empty_statuses
|
||||
@domain.is_admin = true
|
||||
@domain.admin_status_update dp[:statuses]
|
||||
|
||||
if @domain.update(dp)
|
||||
# @domain.admin_store_statuses_history = @domain.statuses
|
||||
# @domain.save
|
||||
flash[:notice] = I18n.t('domain_updated')
|
||||
redirect_to [:admin, @domain]
|
||||
else
|
||||
|
|
|
@ -40,6 +40,7 @@ module Domain::RegistryLockable
|
|||
end
|
||||
self.locked_by_registrant_at = nil
|
||||
self.statuses = admin_store_statuses_history || []
|
||||
admin_store_statuses_history = nil
|
||||
alert_registrar_lock_changes!(lock: false)
|
||||
|
||||
save!
|
||||
|
|
|
@ -557,9 +557,17 @@ class Domain < ApplicationRecord
|
|||
|
||||
# special handling for admin changing status
|
||||
def admin_status_update(update)
|
||||
lock_statuses = [DomainStatus::SERVER_UPDATE_PROHIBITED,
|
||||
DomainStatus::SERVER_DELETE_PROHIBITED,
|
||||
DomainStatus::SERVER_TRANSFER_PROHIBITED]
|
||||
# check for deleted status
|
||||
update(admin_store_statuses_history: update) unless locked_by_registrant?
|
||||
|
||||
update(admin_store_statuses_history: update)
|
||||
if locked_by_registrant?
|
||||
result = update.reject { |status| lock_statuses.include? status }
|
||||
update(admin_store_statuses_history: result)
|
||||
|
||||
end
|
||||
statuses.each do |s|
|
||||
unless update.include? s
|
||||
case s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue