Fix dispute status removal when dispute is closed

This commit is contained in:
Karl Erik Õunapuu 2020-05-15 17:55:20 +03:00
parent be14ede8b6
commit abc1920d45

View file

@ -48,7 +48,7 @@ class Dispute < ApplicationRecord
return if domain return if domain
wr = Whois::Record.find_or_initialize_by(name: domain_name) wr = Whois::Record.find_or_initialize_by(name: domain_name)
wr.json = generate_json(wr) wr.json = @json = generate_json(wr)
wr.save wr.save
end end
@ -64,7 +64,7 @@ class Dispute < ApplicationRecord
def forward_to_auction_if_possible def forward_to_auction_if_possible
domain = DNS::DomainName.new(domain_name) domain = DNS::DomainName.new(domain_name)
return domain.sell_at_auction if domain.available? && domain.auctionable? (domain.sell_at_auction && return) if domain.available? && domain.auctionable?
whois_record = Whois::Record.find_by(name: domain_name) whois_record = Whois::Record.find_by(name: domain_name)
remove_whois_data(whois_record) remove_whois_data(whois_record)
@ -73,10 +73,10 @@ class Dispute < ApplicationRecord
def remove_whois_data(record) def remove_whois_data(record)
return true unless record return true unless record
record.json['status'].delete_if { |status| status == 'disputed' } record.json['status'] = record.json['status'].delete_if { |status| status == 'disputed' }
record.destroy && return if record.json['status'].blank? record.destroy && return if record.json['status'].blank?
save record.save
end end
def generate_json(record) def generate_json(record)