Skip to content

Commit

Permalink
fix(audit): key props now respect configured property exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Sep 25, 2024
1 parent cf4f3ba commit 63f8d86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- feat: better "not found" messages from data sources when the ID is null or empty string. (#447)
- fix(template): adjust manual chunking configuration to avoid circular deps. (#455)
- fix(audit): key props now respect configured property exclusions

# 5.0.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal void PreSaveChanges(DbContext context)
audit.Entries.Add(auditEntry);

auditEntry.Properties = item.Properties
.Where(p => p.Metadata.IsKey() || audit.Configuration.IsAuditedProperty(p))
.Where(p => audit.Configuration.IsAuditedProperty(p))
.Select(p => new AuditEntryProperty
{
Parent = auditEntry,
Expand All @@ -80,10 +80,10 @@ internal void PreSaveChanges(DbContext context)
audit.Entries.Add(auditEntry);

auditEntry.Properties = item.Properties
.Where(p => p.Metadata.IsKey() || (
.Where(p =>
audit.Configuration.IsAuditedProperty(p) &&
!object.Equals(p.CurrentValue, p.OriginalValue)
))
)
.Select(p => new AuditEntryProperty
{
Parent = auditEntry,
Expand All @@ -106,7 +106,7 @@ internal void PostSaveChanges()
case AuditEntryState.EntityAdded:
foreach (var propertyEntry in auditEntry.Entry.Properties)
{
if (!propertyEntry.Metadata.IsKey() && !auditEntry.Parent.Configuration.IsAuditedProperty(propertyEntry))
if (!auditEntry.Parent.Configuration.IsAuditedProperty(propertyEntry))
{
continue;
}
Expand Down

0 comments on commit 63f8d86

Please sign in to comment.