commit ff8db4fd78bd20c141481bf7de0374f1834f760d
parent b2f9af718e67c27c0cb35331485a60d8f4eac284
Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com>
Date: Sat, 21 Oct 2023 00:21:58 +0200
Merge pull request #3951 from teicee/last-active
Adds LastActive on /admin/users API route
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/api/admin.rs b/src/api/admin.rs
@@ -325,6 +325,10 @@ async fn get_users_json(_token: AdminToken, mut conn: DbConn) -> Json<Value> {
let mut usr = u.to_json(&mut conn).await;
usr["UserEnabled"] = json!(u.enabled);
usr["CreatedAt"] = json!(format_naive_datetime_local(&u.created_at, DT_FMT));
+ usr["LastActive"] = match u.last_active(&mut conn).await {
+ Some(dt) => json!(format_naive_datetime_local(&dt, DT_FMT)),
+ None => json!(None::<String>),
+ };
users_json.push(usr);
}