remote-support: Add server data for last audit log update time.

This is useful in the support view in case the audit log data is
stale and user counts are not updated for billing.

Also, renames formatting function for optional datetimes that is
used in the support and activity views/charts. And instead of
showing these datetime strings in the eastern US timezone, we
now show and label them as UTC.
This commit is contained in:
Lauryn Menard
2024-02-05 19:07:13 +01:00
committed by Tim Abbott
parent 51542eb55e
commit 5479053a9f
7 changed files with 22 additions and 26 deletions

View File

@@ -4,7 +4,7 @@ from django.db.models import QuerySet
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from corporate.lib.activity import format_date_for_activity_reports, make_table
from corporate.lib.activity import format_optional_datetime, make_table
from zerver.decorator import require_server_admin
from zerver.models import UserActivity, UserProfile
from zerver.models.users import get_user_profile_by_id
@@ -40,7 +40,7 @@ def get_user_activity(request: HttpRequest, user_profile_id: int) -> HttpRespons
"Query",
"Client",
"Count",
"Last visit",
"Last visit (UTC)",
]
def row(record: UserActivity) -> List[Any]:
@@ -48,7 +48,7 @@ def get_user_activity(request: HttpRequest, user_profile_id: int) -> HttpRespons
record.query,
record.client.name,
record.count,
format_date_for_activity_reports(record.last_visit),
format_optional_datetime(record.last_visit),
]
rows = list(map(row, records))