Skip to content

Commit 03b5012

Browse files
feat: update default audit log avatar (cherry-pick #16774) (#16805)
Cherry-picked feat: update default audit log avatar (#16774) After update: ![image](https://github.com/user-attachments/assets/2ac6707f-2a56-45ec-a88f-651826776744) Co-authored-by: Bruno Quaresma <bruno@coder.com>
1 parent a5eb06e commit 03b5012

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

site/src/components/Avatar/Avatar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const avatarVariants = cva(
5757
export type AvatarProps = AvatarPrimitive.AvatarProps &
5858
VariantProps<typeof avatarVariants> & {
5959
src?: string;
60-
6160
fallback?: string;
6261
};
6362

site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { DropdownArrow } from "components/DropdownArrow/DropdownArrow";
1010
import { Pill } from "components/Pill/Pill";
1111
import { Stack } from "components/Stack/Stack";
1212
import { TimelineEntry } from "components/Timeline/TimelineEntry";
13+
import { NetworkIcon } from "lucide-react";
1314
import { type FC, useState } from "react";
1415
import { Link as RouterLink } from "react-router-dom";
1516
import type { ThemeRole } from "theme/roles";
@@ -101,10 +102,20 @@ export const AuditLogRow: FC<AuditLogRowProps> = ({
101102
css={styles.auditLogHeaderInfo}
102103
>
103104
<Stack direction="row" alignItems="center" css={styles.fullWidth}>
104-
<Avatar
105-
fallback={auditLog.user?.username ?? "?"}
106-
src={auditLog.user?.avatar_url}
107-
/>
105+
{/*
106+
* Session logs don't have an associated user to the log,
107+
* so when it happens we display a default icon to represent non user actions
108+
*/}
109+
{auditLog.user ? (
110+
<Avatar
111+
fallback={auditLog.user.username}
112+
src={auditLog.user.avatar_url}
113+
/>
114+
) : (
115+
<Avatar>
116+
<NetworkIcon className="h-full w-full p-1" />
117+
</Avatar>
118+
)}
108119

109120
<Stack
110121
alignItems="baseline"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy