mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Story#105997358 added more states which prohibit domain to be renewed + simplier days calculation
This commit is contained in:
parent
736aff0fc8
commit
c7cd394214
2 changed files with 11 additions and 2 deletions
|
@ -349,12 +349,16 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
def renewable?
|
def renewable?
|
||||||
if Setting.days_to_renew_domain_before_expire != 0
|
if Setting.days_to_renew_domain_before_expire != 0
|
||||||
if ((valid_to - Time.zone.now.beginning_of_day).to_i / 1.day) + 1 > Setting.days_to_renew_domain_before_expire
|
# if you can renew domain at days_to_renew before domain expiration
|
||||||
|
if (valid_to.to_date - Date.today) + 1 > Setting.days_to_renew_domain_before_expire
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false if statuses.include?(DomainStatus::DELETE_CANDIDATE)
|
return false if statuses.include_any?(DomainStatus::DELETE_CANDIDATE, DomainStatus::SERVER_RENEW_PROHIBITED,
|
||||||
|
DomainStatus::CLIENT_RENEW_PROHIBITED, DomainStatus::PENDING_RENEW,
|
||||||
|
DomainStatus::PENDING_TRANSFER, DomainStatus::PENDING_DELETE,
|
||||||
|
DomainStatus::PENDING_UPDATE, 'pendingDeleteConfirmation')
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
5
config/initializers/array.rb
Normal file
5
config/initializers/array.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class Array
|
||||||
|
def include_any? *args
|
||||||
|
(self & args).any?
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue