mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +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 = Domain.where('valid_to <= ?', Time.zone.now)
|
||||||
d.each do |x|
|
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
|
end
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Successfully expired #{d.count} domains\n" unless Rails.env.test?
|
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 = Domain.where('outzone_at <= ?', Time.zone.now)
|
||||||
d.each do |x|
|
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
|
end
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Successfully set server_hold to #{d.count} domains\n" unless Rails.env.test?
|
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 = Domain.where('delete_at <= ?', Time.zone.now)
|
||||||
d.each do |x|
|
d.each do |x|
|
||||||
x.domain_statuses.create(value: DomainStatus::DELETE_CANDIDATE) if x.delete_candidateable?
|
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
|
end
|
||||||
|
|
||||||
return if Rails.env.test?
|
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::EXPIRED).count.should == 1
|
||||||
domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).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
|
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::EXPIRED).count.should == 0
|
||||||
domain.domain_statuses.where(value: DomainStatus::SERVER_HOLD).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
|
end
|
||||||
|
|
||||||
it 'does not renew foreign domain' do
|
it 'does not renew foreign domain' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue