diff --git a/bin/core/src/api/read/user.rs b/bin/core/src/api/read/user.rs index 3bb944359..d120e5bbb 100644 --- a/bin/core/src/api/read/user.rs +++ b/bin/core/src/api/read/user.rs @@ -6,7 +6,7 @@ use komodo_client::{ ListApiKeysForServiceUserResponse, ListApiKeysResponse, ListUsers, ListUsersResponse, }, - entities::user::{User, UserConfig}, + entities::user::{admin_service_user, User, UserConfig}, }; use mungos::{ by_id::find_one_by_id, @@ -26,6 +26,13 @@ impl Resolve for State { GetUsername { user_id }: GetUsername, _: User, ) -> anyhow::Result { + if let Some(user) = admin_service_user(&user_id) { + return Ok(GetUsernameResponse { + username: user.username, + avatar: None, + }); + } + let user = find_one_by_id(&db_client().users, &user_id) .await .context("failed at mongo query for user")? diff --git a/frontend/src/components/updates/details.tsx b/frontend/src/components/updates/details.tsx index a376797fc..2c4e1b5df 100644 --- a/frontend/src/components/updates/details.tsx +++ b/frontend/src/components/updates/details.tsx @@ -28,7 +28,6 @@ import { Link } from "react-router-dom"; import { fmt_duration, fmt_operation, fmt_version } from "@lib/formatting"; import { cn, - is_service_user, updateLogToHtml, usableResourcePath, version_is_none, @@ -50,44 +49,6 @@ export const UpdateUser = ({ iconSize?: number; defaultAvatar?: boolean; muted?: boolean; -}) => { - if (is_service_user(user_id)) { - return ( -
- - {user_id} -
- ); - } - return ( - - ); -}; - -const RealUpdateUser = ({ - user_id, - className, - iconSize = 4, - defaultAvatar, - muted, -}: { - user_id: string; - className?: string; - iconSize?: number; - defaultAvatar?: boolean; - muted?: boolean; }) => { const res = useRead("GetUsername", { user_id }).data; const username = res?.username; diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts index 21ce9fb05..8515cbfa9 100644 --- a/frontend/src/lib/utils.ts +++ b/frontend/src/lib/utils.ts @@ -231,20 +231,6 @@ export const sync_no_changes = (sync: Types.ResourceSync) => { ); }; -export const is_service_user = (user_id: string) => { - return ( - user_id === "System" || - user_id === "Procedure" || - user_id === "Github" || - user_id === "Git Webhook" || - user_id === "Auto Redeploy" || - user_id === "Resource Sync" || - user_id === "Stack Wizard" || - user_id === "Build Manager" || - user_id === "Repo Manager" - ); -}; - export const extract_registry_domain = (image_name: string) => { if (!image_name) return "docker.io"; const maybe_domain = image_name.split("/")[0];