Refactor team members into the model

Follows the pattern we’re using elsewhere of having less logic in the
view methods.
This commit is contained in:
Chris Hill-Scott
2018-12-03 10:59:36 +00:00
parent 538a06c0bf
commit 8807028097
2 changed files with 13 additions and 10 deletions

View File

@@ -18,19 +18,11 @@ from app.utils import user_has_permissions
@login_required
@user_has_permissions()
def manage_users(service_id):
users = sorted(
(
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,
)
return render_template(
'views/manage-users.html',
users=users,
users=current_service.team_members,
current_user=current_user,
show_search_box=(len(users) > 7),
show_search_box=(len(current_service.team_members) > 7),
form=SearchUsersForm(),
permissions=permissions,
)