mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Add disputes to the list of retained domains
This commit is contained in:
parent
f7f810ad0e
commit
011967d8ea
2 changed files with 64 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
|||
class RetainedDomains
|
||||
RESERVED = 'reserved'.freeze
|
||||
BLOCKED = 'blocked'.freeze
|
||||
DISPUTED = 'disputed'.freeze
|
||||
|
||||
attr_reader :domains,
|
||||
:type
|
||||
|
@ -26,14 +27,15 @@ class RetainedDomains
|
|||
case type
|
||||
when RESERVED then :reserved
|
||||
when BLOCKED then :blocked
|
||||
when DISPUTED then :disputed
|
||||
else :all
|
||||
end
|
||||
end
|
||||
|
||||
def gather_domains
|
||||
domains = blocked_domains.to_a.union(reserved_domains.to_a)
|
||||
|
||||
domains.sort_by(&:name)
|
||||
blocked_domains.to_a
|
||||
.union(reserved_domains.to_a)
|
||||
.union(disputed_domains.to_a)
|
||||
end
|
||||
|
||||
def blocked_domains
|
||||
|
@ -52,16 +54,30 @@ class RetainedDomains
|
|||
end
|
||||
end
|
||||
|
||||
def disputed_domains
|
||||
if %i[all disputed].include?(type)
|
||||
Dispute.order(domain_name: :desc).active
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def domain_to_jsonable(domain)
|
||||
status = case domain
|
||||
when ReservedDomain then RESERVED
|
||||
when BlockedDomain then BLOCKED
|
||||
when Dispute then DISPUTED
|
||||
end
|
||||
|
||||
punycode = SimpleIDN.to_ascii(domain.name)
|
||||
domain_name = case domain
|
||||
when Dispute then domain.domain_name
|
||||
else domain.name
|
||||
end
|
||||
|
||||
punycode = SimpleIDN.to_ascii(domain_name)
|
||||
|
||||
{
|
||||
name: domain.name,
|
||||
name: domain_name,
|
||||
status: status,
|
||||
punycode_name: punycode,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue