Registrant: Only show domains that user is connected with personally / via company

This commit is contained in:
Karl Erik Õunapuu 2020-09-22 16:09:35 +03:00
parent 7b6060b4fb
commit 4f9fa88bd4
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 9 additions and 6 deletions

View file

@ -210,10 +210,13 @@ class Contact < ApplicationRecord
)
end
def registrant_user_contacts(registrant_user)
registrant_user_direct_contacts(registrant_user)
.or(registrant_user_company_contacts(registrant_user))
.or(registrant_user_indirect_contacts(registrant_user))
def registrant_user_contacts(registrant_user, representment: true)
represented_contacts = registrant_user_direct_contacts(registrant_user)
.or(registrant_user_company_contacts(registrant_user))
return represented_contacts if representment
represented_contacts.or(registrant_user_indirect_contacts(registrant_user))
end
def registrant_user_direct_contacts(registrant_user)

View file

@ -22,8 +22,8 @@ class RegistrantUser < User
citizen_country_code: country.alpha3)
end
def contacts
Contact.registrant_user_contacts(self)
def contacts(representment: true)
Contact.registrant_user_contacts(self, representment: representment)
end
def direct_contacts