mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-10 15:13:40 -05:00
Refactor filtering out accepted invites to client
None of our model or view layer code should need to know about accepted invites. We don’t use them anywhere because once an invite is accepted that person is now a user. Putting this logic in the client means that: - none of the code calling the client needs to care about accepted invites - it’s easier to (if we want) update the API code to not return accepted invites
This commit is contained in:
@@ -19,10 +19,10 @@ from app.utils import user_has_permissions
|
||||
@user_has_permissions()
|
||||
def manage_users(service_id):
|
||||
users = sorted(
|
||||
user_api_client.get_users_for_service(service_id=service_id) + [
|
||||
invite for invite in invite_api_client.get_invites_for_service(service_id=service_id)
|
||||
if invite.status != 'accepted'
|
||||
],
|
||||
(
|
||||
user_api_client.get_users_for_service(service_id=service_id) +
|
||||
invite_api_client.get_invites_for_service(service_id=service_id)
|
||||
),
|
||||
key=lambda user: user.email_address,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user