Skip to content

Commit cb4ea1f

Browse files
authored
fix(coderd): fix audit log resource link for tasks (coder#20545) (coder#20547)
Existing task audit log links were incorrect. As audit log links are generated on-the-fly, this does not require backfill. (cherry picked from commit 566146a)
1 parent effbe4e commit cb4ea1f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

coderd/audit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,11 @@ func (api *API) auditLogResourceLink(ctx context.Context, alog database.GetAudit
509509
if err != nil {
510510
return ""
511511
}
512-
workspace, err := api.Database.GetWorkspaceByID(ctx, task.WorkspaceID.UUID)
512+
user, err := api.Database.GetUserByID(ctx, task.OwnerID)
513513
if err != nil {
514514
return ""
515515
}
516-
return fmt.Sprintf("/tasks/%s/%s", workspace.OwnerName, task.Name)
516+
return fmt.Sprintf("/tasks/%s/%s", user.Username, task.ID)
517517

518518
default:
519519
return ""

0 commit comments

Comments
 (0)