mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: remove org_id from audit diffs (#4668)
* chore: remove org_id from audit diffs * PR feedback * fix tests
This commit is contained in:
@ -256,7 +256,6 @@ func Test_diff(t *testing.T) {
|
|||||||
},
|
},
|
||||||
exp: audit.Map{
|
exp: audit.Map{
|
||||||
"id": audit.OldNew{Old: "", New: uuid.UUID{1}.String()},
|
"id": audit.OldNew{Old: "", New: uuid.UUID{1}.String()},
|
||||||
"organization_id": audit.OldNew{Old: "", New: uuid.UUID{2}.String()},
|
|
||||||
"name": audit.OldNew{Old: "", New: "rust"},
|
"name": audit.OldNew{Old: "", New: "rust"},
|
||||||
"provisioner": audit.OldNew{Old: database.ProvisionerType(""), New: database.ProvisionerTypeTerraform},
|
"provisioner": audit.OldNew{Old: database.ProvisionerType(""), New: database.ProvisionerTypeTerraform},
|
||||||
"active_version_id": audit.OldNew{Old: "", New: uuid.UUID{3}.String()},
|
"active_version_id": audit.OldNew{Old: "", New: uuid.UUID{3}.String()},
|
||||||
@ -281,11 +280,10 @@ func Test_diff(t *testing.T) {
|
|||||||
CreatedBy: uuid.NullUUID{UUID: uuid.UUID{4}, Valid: true},
|
CreatedBy: uuid.NullUUID{UUID: uuid.UUID{4}, Valid: true},
|
||||||
},
|
},
|
||||||
exp: audit.Map{
|
exp: audit.Map{
|
||||||
"id": audit.OldNew{Old: "", New: uuid.UUID{1}.String()},
|
"id": audit.OldNew{Old: "", New: uuid.UUID{1}.String()},
|
||||||
"template_id": audit.OldNew{Old: "", New: uuid.UUID{2}.String()},
|
"template_id": audit.OldNew{Old: "", New: uuid.UUID{2}.String()},
|
||||||
"organization_id": audit.OldNew{Old: "", New: uuid.UUID{3}.String()},
|
"created_by": audit.OldNew{Old: "", New: uuid.UUID{4}.String()},
|
||||||
"created_by": audit.OldNew{Old: "", New: uuid.UUID{4}.String()},
|
"name": audit.OldNew{Old: "", New: "rust"},
|
||||||
"name": audit.OldNew{Old: "", New: "rust"},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -301,10 +299,9 @@ func Test_diff(t *testing.T) {
|
|||||||
CreatedBy: uuid.NullUUID{UUID: uuid.UUID{4}, Valid: true},
|
CreatedBy: uuid.NullUUID{UUID: uuid.UUID{4}, Valid: true},
|
||||||
},
|
},
|
||||||
exp: audit.Map{
|
exp: audit.Map{
|
||||||
"id": audit.OldNew{Old: "", New: uuid.UUID{1}.String()},
|
"id": audit.OldNew{Old: "", New: uuid.UUID{1}.String()},
|
||||||
"organization_id": audit.OldNew{Old: "", New: uuid.UUID{3}.String()},
|
"created_by": audit.OldNew{Old: "null", New: uuid.UUID{4}.String()},
|
||||||
"created_by": audit.OldNew{Old: "null", New: uuid.UUID{4}.String()},
|
"name": audit.OldNew{Old: "", New: "rust"},
|
||||||
"name": audit.OldNew{Old: "", New: "rust"},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -51,7 +51,7 @@ var AuditableResources = auditMap(map[any]map[string]Action{
|
|||||||
"id": ActionTrack,
|
"id": ActionTrack,
|
||||||
"created_at": ActionIgnore, // Never changes, but is implicit and not helpful in a diff.
|
"created_at": ActionIgnore, // Never changes, but is implicit and not helpful in a diff.
|
||||||
"updated_at": ActionIgnore, // Changes, but is implicit and not helpful in a diff.
|
"updated_at": ActionIgnore, // Changes, but is implicit and not helpful in a diff.
|
||||||
"organization_id": ActionTrack,
|
"organization_id": ActionIgnore, /// Never changes.
|
||||||
"deleted": ActionIgnore, // Changes, but is implicit when a delete event is fired.
|
"deleted": ActionIgnore, // Changes, but is implicit when a delete event is fired.
|
||||||
"name": ActionTrack,
|
"name": ActionTrack,
|
||||||
"provisioner": ActionTrack,
|
"provisioner": ActionTrack,
|
||||||
@ -68,7 +68,7 @@ var AuditableResources = auditMap(map[any]map[string]Action{
|
|||||||
&database.TemplateVersion{}: {
|
&database.TemplateVersion{}: {
|
||||||
"id": ActionTrack,
|
"id": ActionTrack,
|
||||||
"template_id": ActionTrack,
|
"template_id": ActionTrack,
|
||||||
"organization_id": ActionTrack,
|
"organization_id": ActionIgnore, // Never changes.
|
||||||
"created_at": ActionIgnore, // Never changes, but is implicit and not helpful in a diff.
|
"created_at": ActionIgnore, // Never changes, but is implicit and not helpful in a diff.
|
||||||
"updated_at": ActionIgnore, // Changes, but is implicit and not helpful in a diff.
|
"updated_at": ActionIgnore, // Changes, but is implicit and not helpful in a diff.
|
||||||
"name": ActionTrack,
|
"name": ActionTrack,
|
||||||
@ -95,7 +95,7 @@ var AuditableResources = auditMap(map[any]map[string]Action{
|
|||||||
"created_at": ActionIgnore, // Never changes.
|
"created_at": ActionIgnore, // Never changes.
|
||||||
"updated_at": ActionIgnore, // Changes, but is implicit and not helpful in a diff.
|
"updated_at": ActionIgnore, // Changes, but is implicit and not helpful in a diff.
|
||||||
"owner_id": ActionTrack,
|
"owner_id": ActionTrack,
|
||||||
"organization_id": ActionTrack,
|
"organization_id": ActionIgnore, // Never changes.
|
||||||
"template_id": ActionTrack,
|
"template_id": ActionTrack,
|
||||||
"deleted": ActionIgnore, // Changes, but is implicit when a delete event is fired.
|
"deleted": ActionIgnore, // Changes, but is implicit when a delete event is fired.
|
||||||
"name": ActionTrack,
|
"name": ActionTrack,
|
||||||
@ -106,7 +106,7 @@ var AuditableResources = auditMap(map[any]map[string]Action{
|
|||||||
&database.Group{}: {
|
&database.Group{}: {
|
||||||
"id": ActionTrack,
|
"id": ActionTrack,
|
||||||
"name": ActionTrack,
|
"name": ActionTrack,
|
||||||
"organization_id": ActionTrack,
|
"organization_id": ActionIgnore, // Never changes.
|
||||||
"avatar_url": ActionTrack,
|
"avatar_url": ActionTrack,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user