diff --git a/app/models/concerns/domain/releasable.rb b/app/models/concerns/domain/releasable.rb index 12a182b65..b800a4aa5 100644 --- a/app/models/concerns/domain/releasable.rb +++ b/app/models/concerns/domain/releasable.rb @@ -39,16 +39,16 @@ module Concerns def release if release_to_auction - with_lock do - to_stdout "Checking if domain_name is auctionable: #{domain_name.auctionable?}" - domain_name.sell_at_auction if domain_name.auctionable? - to_stdout 'Destroying domain' - destroy! - to_stdout 'Sending registrar notification' - registrar.notifications.create!(text: "#{I18n.t(:domain_deleted)}: #{name}", - attached_obj_id: id, - attached_obj_type: self.class) - end + lock! + to_stdout 'Destroying domain' + destroy! + to_stdout "Checking if domain_name is auctionable: #{domain_name.auctionable?}" + domain_name.sell_at_auction if domain_name.auctionable? + + to_stdout 'Sending registrar notification' + registrar.notifications.create!(text: "#{I18n.t(:domain_deleted)}: #{name}", + attached_obj_id: id, + attached_obj_type: self.class) else discard end diff --git a/app/models/domain.rb b/app/models/domain.rb index 49f18d9db..589a0b661 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -78,7 +78,7 @@ class Domain < ApplicationRecord true end - after_commit :update_whois_record, unless: -> { domain_name.at_auction? } + after_commit :update_whois_record after_create :update_reserved_domains def update_reserved_domains diff --git a/test/models/domain/releasable/auctionable_test.rb b/test/models/domain/releasable/auctionable_test.rb index a74f41c90..d24f46913 100644 --- a/test/models/domain/releasable/auctionable_test.rb +++ b/test/models/domain/releasable/auctionable_test.rb @@ -63,11 +63,15 @@ class DomainReleasableAuctionableTest < ActiveSupport::TestCase def test_updates_whois_server @domain.update!(delete_date: '2010-07-04') travel_to Time.zone.parse('2010-07-05') + old_whois = @domain.whois_record Domain.release_domains - whois_record = Whois::Record.find_by(name: @domain.name) + assert_raises ActiveRecord::RecordNotFound do + old_whois.reload + end + whois_record = Whois::Record.find_by(name: @domain.name) json = { "name"=>@domain.name, "status"=>["AtAuction"], "disclaimer"=> Setting.registry_whois_disclaimer }