mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Renew: Attach uneligibility reason
This commit is contained in:
parent
9976e3dd93
commit
29897043b0
3 changed files with 22 additions and 8 deletions
|
@ -306,12 +306,7 @@ class Domain < ApplicationRecord
|
|||
end
|
||||
|
||||
def renewable?
|
||||
disallowed = [DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW,
|
||||
DomainStatus::PENDING_TRANSFER, DomainStatus::CLIENT_RENEW_PROHIBITED,
|
||||
DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE,
|
||||
DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::SERVER_RENEW_PROHIBITED]
|
||||
|
||||
return false unless (statuses & disallowed).empty?
|
||||
return false unless renew_blocking_statuses.empty?
|
||||
return true unless Setting.days_to_renew_domain_before_expire != 0
|
||||
|
||||
# if you can renew domain at days_to_renew before domain expiration
|
||||
|
@ -322,6 +317,15 @@ class Domain < ApplicationRecord
|
|||
true
|
||||
end
|
||||
|
||||
def renew_blocking_statuses
|
||||
disallowed = [DomainStatus::DELETE_CANDIDATE, DomainStatus::PENDING_RENEW,
|
||||
DomainStatus::PENDING_TRANSFER, DomainStatus::CLIENT_RENEW_PROHIBITED,
|
||||
DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_DELETE,
|
||||
DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::SERVER_RENEW_PROHIBITED]
|
||||
|
||||
(statuses & disallowed)
|
||||
end
|
||||
|
||||
def notify_registrar(message_key)
|
||||
registrar.notifications.create!(
|
||||
text: "#{I18n.t(message_key)}: #{name}",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue