audited 5.4.3 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32e366c7864b72cc3729bd15673e391ff3f45fee1b6ab0f2789ed8499588002f
4
- data.tar.gz: 6a3f24da58730f880eaa1e7e607f33ef5bf74a035b477249e7d34f827e36728c
3
+ metadata.gz: 4d9407750d2b70edd5e934c0b0544ba52230a3e3ac4955194029b6b7370c8fe7
4
+ data.tar.gz: 863fc4f2e8d1cc188664f4a346db886f7dfdd4bf6c6b56f3371eacb4d75497dd
5
5
  SHA512:
6
- metadata.gz: fb1332090ad6d301af3d61a2948b8376f33dad8bea9c431ad480432f3c8d80837b9202f718e69be2dcdb0bb7bab8a329d77ae45e2fc50c533b6c79979e5d2b49
7
- data.tar.gz: 632aae39c6307342b8430308f2f093e03a1b172f8ce0c08a3ed87f380f48b39e5fff63b2132fa93f9a5d0dec4a08b391671f52b5d2173a680c951aa27b4537f9
6
+ metadata.gz: cb853e42fb4e6ff1493f3864a0c5833e730b27e90f14d8b8529ad11c3dd66052c8bd3739433e4c08decd84ecb5525a244ab8a831bf70a7a21654c398e220b8c7
7
+ data.tar.gz: 36d1acab56d4011d8766f0a3f0126ecae8fff5a7469a3ac00a43d6ccc3e1f09eee5c8e8054d30367dbdf69caab3f49135020861ca16d10a76e5f44349e14a57f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Audited ChangeLog
2
2
 
3
+ ### 5.5.0 (2024-04-02)
4
+
5
+ - Removed support for Rails 5.0 and 5.1.
6
+ - Replace RequestStore with ActiveSupport::CurrentAttributes - @punkisdead
7
+ [#702](https://github.com/collectiveidea/audited/pull/702)
8
+
3
9
  ### 5.4.3 (2024-01-11)
4
10
 
5
11
  - Ignore readonly columns in audit - @sriddbs
data/README.md CHANGED
@@ -8,8 +8,9 @@ Audited
8
8
  **Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited can also record who made those changes, save comments and associate models related to the changes.
9
9
 
10
10
 
11
- Audited currently (5.x) works with Rails 7.1, 7.0, 6.1, 6.0, 5.2, 5.1, and 5.0.
11
+ Audited currently (5.5) works with Rails 7.1, 7.0, 6.1, 6.0, 5.2.
12
12
 
13
+ For Rails 5.0 & 5.1, use gem version 5.4.3
13
14
  For Rails 4, use gem version 4.x
14
15
  For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable).
15
16
 
@@ -249,6 +249,8 @@ module Audited
249
249
  all_changes.except(*self.class.non_audited_columns)
250
250
  end
251
251
 
252
+ filtered_changes = normalize_enum_changes(filtered_changes)
253
+
252
254
  if for_touch && (last_audit = audits.last&.audited_changes)
253
255
  filtered_changes.reject! do |k, v|
254
256
  last_audit[k].to_json == v.to_json ||
@@ -258,7 +260,6 @@ module Audited
258
260
 
259
261
  filtered_changes = redact_values(filtered_changes)
260
262
  filtered_changes = filter_encrypted_attrs(filtered_changes)
261
- filtered_changes = normalize_enum_changes(filtered_changes)
262
263
  filtered_changes.to_hash
263
264
  end
264
265
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Audited
4
- VERSION = "5.4.3"
4
+ VERSION = "5.5.0"
5
5
  end
@@ -540,6 +540,14 @@ describe Audited::Auditor do
540
540
  expect(user.audits.last.action).to eq("update")
541
541
  expect(user.audits.last.audited_changes.keys).to eq(%w[suspended_at])
542
542
  end
543
+
544
+ it "updating nested resource through parent while changing an enum on parent shouldn't double audit" do
545
+ user.status = :reliable
546
+ user.companies_attributes = [{name: "test"}]
547
+ expect { user.save }.to change(user.audits, :count).from(1).to(2)
548
+ expect(user.audits.last.action).to eq("update")
549
+ expect(user.audits.last.audited_changes.keys).to eq(%w[status])
550
+ end
543
551
  end
544
552
 
545
553
  context "after updating" do
@@ -136,6 +136,7 @@ module Models
136
136
  has_associated_audits
137
137
  has_many :companies, class_name: "OwnedCompany", dependent: :destroy
138
138
  accepts_nested_attributes_for :companies
139
+ enum status: {active: 0, reliable: 1, banned: 2}
139
140
  end
140
141
 
141
142
  class OwnedCompany < ::ActiveRecord::Base
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audited
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.3
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2024-01-11 00:00:00.000000000 Z
16
+ date: 2024-04-02 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activerecord