Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit78df786

Browse files
refactor: name null users in audit logs (#16890)
A few audit logs can have the user as null which means the user is notauthenticated when executing the action. To make it more explicit wenamed than as "Unauthenticated user" in the log description instead of"undefined user".
1 parent5285c12 commit78df786

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

‎site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/AuditLogDescription.stories.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,12 @@ export const SCIMUpdateUser: Story = {
105105
},
106106
},
107107
};
108+
109+
exportconstUnauthenticatedUser:Story={
110+
args:{
111+
auditLog:{
112+
...MockAuditLog,
113+
user:null,
114+
},
115+
},
116+
};

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export const AuditLogDescription: FC<AuditLogDescriptionProps> = ({
1919
}
2020

2121
lettarget=auditLog.resource_target.trim();
22-
letuser=auditLog.user?.username.trim();
22+
letuser=auditLog.user
23+
?auditLog.user.username.trim()
24+
:"Unauthenticated user";
2325

2426
// SSH key entries have no links
2527
if(auditLog.resource_type==="git_ssh_key"){

‎site/src/pages/AuditPage/AuditLogRow/AuditLogDescription/BuildAuditDescription.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export const BuildAuditDescription: FC<BuildAuditDescriptionProps> = ({
1616
auditLog.additional_fields?.build_reason&&
1717
auditLog.additional_fields?.build_reason!=="initiator"
1818
?"Coder automatically"
19-
:auditLog.user?.username.trim();
19+
:auditLog.user
20+
?auditLog.user.username.trim()
21+
:"Unauthenticated user";
2022

2123
constaction=useMemo(()=>{
2224
switch(auditLog.action){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp