Merge branch '1832-registrar-prefix-on-contact-info-and-check-requests' of https://github.com/internetee/registry into 1832-registrar-prefix-on-contact-info-and-check-requests

This commit is contained in:
Karl Erik Õunapuu 2021-02-10 12:03:36 +02:00
commit 0b3fd56fc8
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 57 additions and 11 deletions

View file

@ -44,16 +44,10 @@ class Epp::Contact < Contact
def check_availability(codes, reg:)
codes = [codes] if codes.is_a?(String)
codes = codes.map { |c| c.include?(':') ? c : "#{reg}:#{c}" }
res = []
codes.each do |x|
contact = find_by_epp_code(x)
if contact
res << { code: contact.code, avail: 0, reason: 'in use' }
else
res << { code: x, avail: 1 }
end
codes.map { |c| c.strip.upcase }.map { |c| c.include?(':') ? c : "#{reg}:#{c}" }.each do |x|
c = find_by_epp_code(x)
res << c ? { code: c.code, avail: 0, reason: 'in use' } : { code: x, avail: 1 }
end
res