From 529a8a1bf698bb48f35fa93d5e536c8a8029f74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Erik=20=C3=95unapuu?= Date: Fri, 8 May 2020 15:48:48 +0300 Subject: [PATCH] Send unregistered domain to auction after dispute is closed --- app/models/dispute.rb | 12 ++++++++++-- app/models/dns/domain_name.rb | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/models/dispute.rb b/app/models/dispute.rb index b80a33e9c..a21ef28f7 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -55,8 +55,16 @@ class Dispute < ApplicationRecord return false unless update(closed: true) return if Dispute.active.where(domain_name: domain_name).any? - whois_record = Whois::Record.find_or_initialize_by(name: domain_name) - return true if remove_whois_data(whois_record) + domain = DNS::DomainName.new(domain_name) + if domain.available? && domain.auctionable? + domain.sell_at_auction + return true + else + whois_record = Whois::Record.find_or_initialize_by(name: domain_name) + return true if remove_whois_data(whois_record) + end + + false end def remove_whois_data(record) diff --git a/app/models/dns/domain_name.rb b/app/models/dns/domain_name.rb index c1af4d5e7..7df38341c 100644 --- a/app/models/dns/domain_name.rb +++ b/app/models/dns/domain_name.rb @@ -29,6 +29,8 @@ module DNS :at_auction elsif awaiting_payment? :awaiting_payment + elsif disputed? + :disputed end end