mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 23:54:44 +02:00
Find requester's tied domains via RegistrantUser
This commit is contained in:
parent
572510d7b0
commit
bcd6f0bd71
1 changed files with 8 additions and 9 deletions
|
@ -451,17 +451,16 @@ class Contact < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def qualified_domain_name_list(requester, filter_sql)
|
def qualified_domain_name_list(requester, filter_sql)
|
||||||
if requester != id
|
return Domain.where('domains.id IN (?)', filter_sql) unless requester != id
|
||||||
first_scope = Contact.find(requester).domains
|
|
||||||
second_scope = Contact.find(requester).registrant_domains
|
|
||||||
|
|
||||||
domains = Domain.from("(#{first_scope.to_sql} UNION #{second_scope.to_sql}) as domains")
|
requester = Contact.find_by(id: requester)
|
||||||
.where('domains.id IN (?)', filter_sql)
|
registrant_user = RegistrantUser.find_or_initialize_by(registrant_ident:
|
||||||
else
|
"#{requester.ident_country_code}-#{requester.ident}")
|
||||||
domains = Domain.where('domains.id IN (?)', filter_sql)
|
begin
|
||||||
|
registrant_user.domains.where('domains.id IN (?)', filter_sql)
|
||||||
|
rescue CompanyRegister::NotAvailableError
|
||||||
|
registrant_user.direct_domains.where('domains.id IN (?)', filter_sql)
|
||||||
end
|
end
|
||||||
|
|
||||||
domains
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def qualified_domain_ids(domain_filter)
|
def qualified_domain_ids(domain_filter)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue