Merge pull request #2403 from internetee/exceptions-for-registered-domains-and-no-bids-auctions

added exception for auctions with no-bids and registred-domains statuses
This commit is contained in:
Timo Võhmar 2022-10-20 09:18:32 +03:00 committed by GitHub
commit 4a31cc3b15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 9 deletions

View file

@ -31,7 +31,7 @@ module Admin
def create
auction = Auction.new(domain: params[:domain], status: Auction.statuses[:started], platform: 'manual')
if domain_exists_in_blocked_disputed_and_registered?(params[:domain])
if Auction.domain_exists_in_blocked_disputed_and_registered?(params[:domain])
flash[:alert] = "Adding #{params[:domain]} failed - domain registered or regsitration is blocked"
redirect_to admin_auctions_path and return
end
@ -81,7 +81,7 @@ module Admin
table.each do |row|
record = row.to_h
if domain_exists_in_blocked_disputed_and_registered?(record['name'])
if Auction.domain_exists_in_blocked_disputed_and_registered?(record['name'])
failed_names << record['name']
next
@ -119,13 +119,6 @@ module Admin
Epp::Domain.check_availability(domain_name)
end
def domain_exists_in_blocked_disputed_and_registered?(domain_name)
Domain.exists?(name: domain_name) ||
BlockedDomain.exists?(name: domain_name) ||
Dispute.exists?(domain_name: domain_name) ||
Auction.exists?(domain: domain_name)
end
def validate_table(table)
first_row = table.headers
first_row.include? 'name'