Show user names for events without API changes

This commit introduces a slightly hacky way of putting usernames against
events, given that the API only returns user IDs.

It does so without:
- making changes to the API
- making a pages that could potentially fire off dozens of API calls (ie
  one per user)

This comes with the limitation that it can only get names for those team
members who are still in the team. Otherwise it will say ‘Unknown’.

In the future the API should probably return the name and email address
for the user who initiated the event, and whether that user was acting
in a platform admin capacity.
This commit is contained in:
Chris Hill-Scott
2019-10-21 14:08:18 +01:00
parent 9055a33dca
commit 600e3affc1
5 changed files with 20 additions and 13 deletions

View File

@@ -19,7 +19,8 @@ def history(service_id):
days=_chunk_events_by_day(events),
show_navigation=request.args.get('selected') or any(
isinstance(event, APIKeyEvent) for event in events
)
),
user_getter=current_service.active_users.get_name_from_id,
)