Merge pull request #2553 from alphagov/better-live-search-team

Scope live search on team page to name and email
This commit is contained in:
Chris Hill-Scott
2018-12-05 16:46:15 +00:00
committed by GitHub
6 changed files with 34 additions and 37 deletions

View File

@@ -6,6 +6,7 @@ from app.notify_client.api_key_api_client import api_key_api_client
from app.notify_client.billing_api_client import billing_api_client
from app.notify_client.email_branding_client import email_branding_client
from app.notify_client.inbound_number_client import inbound_number_client
from app.notify_client.invite_api_client import invite_api_client
from app.notify_client.job_api_client import job_api_client
from app.notify_client.organisations_api_client import organisations_client
from app.notify_client.service_api_client import service_api_client
@@ -98,6 +99,16 @@ class Service():
def has_jobs(self):
return job_api_client.has_jobs(self.id)
@cached_property
def team_members(self):
return sorted(
(
invite_api_client.get_invites_for_service(service_id=self.id) +
user_api_client.get_users_for_service(service_id=self.id)
),
key=lambda user: user.email_address,
)
@cached_property
def has_team_members(self):
return user_api_client.get_count_of_users_with_permission(