mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
added tests
This commit is contained in:
parent
3f8a99d8ca
commit
1cc6f2576f
6 changed files with 55 additions and 9 deletions
|
@ -12,6 +12,10 @@ 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
|
||||
|
@ -557,17 +561,14 @@ 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?
|
||||
|
||||
if locked_by_registrant?
|
||||
result = update.reject { |status| lock_statuses.include? status }
|
||||
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