mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Remove OK status on expire #2622
This commit is contained in:
parent
2af47921f2
commit
1e23641e01
2 changed files with 12 additions and 2 deletions
|
@ -152,7 +152,10 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
d = Domain.where('valid_to <= ?', Time.zone.now)
|
||||
d.each do |x|
|
||||
x.domain_statuses.create(value: DomainStatus::EXPIRED) if x.expirable?
|
||||
next unless x.expirable?
|
||||
x.domain_statuses.create(value: DomainStatus::EXPIRED)
|
||||
# TODO: This should be managed by automatic_statuses
|
||||
x.domain_statuses.where(value: DomainStatus::OK).destroy_all
|
||||
end
|
||||
|
||||
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test?
|
||||
|
@ -163,7 +166,10 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
d = Domain.where('outzone_at <= ?', Time.zone.now)
|
||||
d.each do |x|
|
||||
x.domain_statuses.create(value: DomainStatus::SERVER_HOLD) if x.server_holdable?
|
||||
next unless x.server_holdable?
|
||||
x.domain_statuses.create(value: DomainStatus::SERVER_HOLD)
|
||||
# TODO: This should be managed by automatic_statuses
|
||||
x.domain_statuses.where(value: DomainStatus::OK).destroy_all
|
||||
end
|
||||
|
||||
STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test?
|
||||
|
@ -175,6 +181,8 @@ class Domain < ActiveRecord::Base
|
|||
d = Domain.where('delete_at <= ?', Time.zone.now)
|
||||
d.each do |x|
|
||||
x.domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if x.delete_candidateable?
|
||||
# TODO: This should be managed by automatic_statuses
|
||||
x.domain_statuses.where(value: DomainStatus::OK).destroy_all
|
||||
end
|
||||
|
||||
return if Rails.env.test?
|
||||
|
|
|
@ -2078,6 +2078,7 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 1
|
||||
domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 1
|
||||
domain.domain_statuses.where(value: DomainStatus::OK).count.should == 0
|
||||
|
||||
exp_date = domain.valid_to.to_date
|
||||
|
||||
|
@ -2093,6 +2094,7 @@ describe 'EPP Domain', epp: true do
|
|||
|
||||
domain.domain_statuses.where(value: DomainStatus::EXPIRED).count.should == 0
|
||||
domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).count.should == 0
|
||||
domain.domain_statuses.where(value: DomainStatus::OK).count.should == 1
|
||||
end
|
||||
|
||||
it 'does not renew foreign domain' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue