Skip to content

Commit e83a3a4

Browse files
committed
add user-agent support to background audit
1 parent e70e384 commit e83a3a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

coderd/audit/request.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ type BackgroundAuditParams[T Auditable] struct {
7171
Action database.AuditAction
7272
OrganizationID uuid.UUID
7373
IP string
74+
UserAgent string
7475
// todo: this should automatically marshal an interface{} instead of accepting a raw message.
7576
AdditionalFields json.RawMessage
7677

@@ -479,7 +480,7 @@ func BackgroundAudit[T Auditable](ctx context.Context, p *BackgroundAuditParams[
479480
UserID: p.UserID,
480481
OrganizationID: requireOrgID[T](ctx, p.OrganizationID, p.Log),
481482
Ip: ip,
482-
UserAgent: sql.NullString{},
483+
UserAgent: sql.NullString{Valid: p.UserAgent != "", String: p.UserAgent},
483484
ResourceType: either(p.Old, p.New, ResourceType[T], p.Action),
484485
ResourceID: either(p.Old, p.New, ResourceID[T], p.Action),
485486
ResourceTarget: either(p.Old, p.New, ResourceTarget[T], p.Action),

0 commit comments

Comments
 (0)