mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
Refactor live services check
Changes the check to say ‘does the user have any live services’ rather than ‘are all their services in trial mode’. The former is closer to meaning the thing we care about. Also has the opportunity to short-circuit without having to go through the full list.
This commit is contained in:
@@ -220,8 +220,8 @@ class UserApiClient(NotifyAdminAPIClient):
|
||||
return sorted(all_services, key=lambda service: service['name'])
|
||||
|
||||
def user_has_live_services(self, user):
|
||||
return not all(
|
||||
service['restricted'] for service in self.get_services_for_user(user)
|
||||
return any(
|
||||
not service['restricted'] for service in self.get_services_for_user(user)
|
||||
)
|
||||
|
||||
def get_service_ids_for_user(self, user):
|
||||
|
||||
Reference in New Issue
Block a user