inline_forms_installer 8.1.16 → 8.1.17

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: 6239acf08fdfdd6a13a2bdc0cdb64d09175dc76e12297aefb854efe97b1c7210
4
- data.tar.gz: 0ec799f3e8bb895459b2e581074b782757dc05806187e38d098fccf2c95d7f87
3
+ metadata.gz: c46819a2ebdd8fc0e78bf6552f9ad15e07f32683c11c9e0c36c8461a2b3e53f7
4
+ data.tar.gz: 488a04adfc5490222bbeb037e302bc11cb229b60002b88e384de26ac2aa1d562
5
5
  SHA512:
6
- metadata.gz: 469c80a9b337acb714b5b80cb1b07437689893c5cc102acf68277c98484cec8edcbe812a7f51225565334e127e07090b1f3ff30de4777a94f87dba53953e4b5e
7
- data.tar.gz: bd20ad4a92974a8da353c29f5bd065d2e03e82e344034d3e97ac2c8575dee5038b17131655310de0768356015454e0ccf42f12425dc90343c3ca2425f164a7e0
6
+ metadata.gz: a64cb19004014e639af9a1c3bb6cbec783521929fc36b5f50f782f21f622db5402e2c45210a08cb2744301e2d1d54b3479c146cc465b266c6ea337918881f809
7
+ data.tar.gz: 862b03e84c8b8627bbd55ac2611e87da3bc0c20979d6d4755642967503b01e3861607caa5fdc594ea58e3aab4e47800a2a13861501392ed1bbfd90d36fecb133
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineFormsInstaller
3
- VERSION = "8.1.16"
3
+ VERSION = "8.1.17"
4
4
 
5
5
  # Written into generated apps' `.ruby-version` (must match gemspec `required_ruby_version`).
6
6
  TARGET_RUBY_VERSION = "ruby-4.0.4"
@@ -93,4 +93,42 @@ class ExampleAppPhotosTest < ExampleAppIntegrationTestCase
93
93
  ).count
94
94
  assert_includes Photo.find(photo_id).description.body.to_html, "Twice undo"
95
95
  end
96
+
97
+ # Regression: PaperTrail records a non-empty changeset for `destroy` events,
98
+ # so the versions panel shows a Restore link on `destroy` rows. Reverting a
99
+ # `destroy` reifies a record with the original PK and `new_record? == true`.
100
+ # Once the row has already been restored (undone), the old `@parent.save!`
101
+ # re-INSERTed that PK -> `RecordNotUnique` (`UNIQUE constraint failed:
102
+ # photos.id`). Revert must be idempotent: restoring a `destroy` version while
103
+ # the row exists updates it in place instead of crashing.
104
+ test "restoring a destroy version while the photo exists does not raise RecordNotUnique" do
105
+ photo = @apartment.photos.create!(name: "restore.jpg", caption: "before")
106
+ photo.update!(caption: "after")
107
+ photo_id = photo.id
108
+
109
+ row_frame = "apartment_#{@apartment.id}_photo_#{photo_id}"
110
+ row_headers = { "Turbo-Frame" => row_frame, "Accept" => "text/html" }
111
+ stream_headers = row_headers.merge("Accept" => "text/vnd.turbo-stream.html")
112
+
113
+ delete photo_path(photo, update: row_frame), headers: row_headers
114
+ assert_response :success
115
+
116
+ destroy_version = PaperTrail::Version.where(
117
+ item_type: "Photo",
118
+ item_id: photo_id,
119
+ event: "destroy"
120
+ ).order(:id).last
121
+ assert destroy_version, "expected a Photo destroy version"
122
+
123
+ post revert_photo_path(destroy_version, update: row_frame), headers: stream_headers
124
+ assert_response :success
125
+ assert Photo.exists?(photo_id), "undo should have restored the photo row"
126
+
127
+ # The row now exists again. Restoring the SAME destroy version (panel
128
+ # Restore link, or a replayed undo) must not INSERT a duplicate id.
129
+ post revert_photo_path(destroy_version, update: row_frame), headers: stream_headers
130
+ assert_response :success,
131
+ "restoring a destroy version while the row exists must not raise RecordNotUnique"
132
+ assert_equal 1, Photo.where(id: photo_id).count
133
+ end
96
134
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms_installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.16
4
+ version: 8.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares