inline_forms 8.1.13 → 8.1.15

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: 5ae9fa81e904412a8066f7b989cc62d751ecd2ec388e86280a9f29c40c71066c
4
- data.tar.gz: a1ef139cf1a6ab1827a79dfe4b13b83cc106dbaf4618f3840a4f00c623139d30
3
+ metadata.gz: 58e6670831f8bce627752b9797371fb20d2f3b14f571a4bc8c879478b71f5ff6
4
+ data.tar.gz: 32fd5f2f3503126e9113d10a3bea9ba23468667f11cc4db8252d78078b101af8
5
5
  SHA512:
6
- metadata.gz: 87a7b60dbc16267a2b1415374747785df190d82fb00d9df751dd6b3c47e9f02a82e2d2127ff04784fe659d6709ffd64044952c013c11fc49af0bad47284a29c7
7
- data.tar.gz: 4452500f6fa5b2e6f1010a61e3a5f30ba755b44de4861a09868787136a4f06aa4873d545b03e68af782d0239bd8d55289c60cbdce22fde565d26d4ccda24a28f
6
+ metadata.gz: d9e59af7820b05e5ef046c1771a85f37ee1d7dd4ab9affbe0f8e2dfda03fe49db57d9452972406a889f699732165b8117bb56ecdee6c6a5edf9c05b0d14642f8
7
+ data.tar.gz: 55be4d675321e511079de4a362688b664e65dce704dd56ef5929c8db2a286f0fef034312a2572016138808155a18e4f7150472a26aa904adb65e926d762da949
data/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [8.1.15] - 2026-05-28
8
+
9
+ ### Fixed
10
+
11
+ - **Post-delete undo on Apartment/Photo (and any model with `rich_text`) left `description` empty.** Undo only reified the parent row; ActionText bodies live in `action_text_rich_texts` and are removed on `destroy`, with separate PaperTrail `destroy` versions. `revert` now also reifies and saves each `ActionText::RichText` destroy snapshot that belonged to the restored parent (Apartment, nested Photo, `FormElementShowcase#description`, etc.).
12
+
13
+ ### Added
14
+
15
+ - **Regression tests:** apartment row destroy+undo with `description` rich text; nested photo destroy+undo with `description` rich text.
16
+
17
+ ## [8.1.14] - 2026-05-28
18
+
19
+ ### Fixed
20
+
21
+ - **`example_app_showcase_row_turbo_test` broke `--example` installs.** The Empty-demo undo regression parsed the undo URL as `/revert/:id`, but member routes are `/form_element_showcases/:id/revert`. The installer gate failed (`131 runs, 1 failure`) and surfaced the misleading “Rails could not create the app 'MyApp', maybe because it is a reserved word…” message even though the app was generated. The test now matches the real path and loads the destroy version from PaperTrail.
22
+
7
23
  ## [8.1.13] - 2026-05-28
8
24
 
9
25
  ### Fixed
@@ -320,12 +320,37 @@ class InlineFormsController < ApplicationController
320
320
  else
321
321
  @parent = @object
322
322
  @parent.save!
323
+ restore_rich_texts_for_reverted_parent!(@parent)
324
+ @parent.reload
323
325
  end
324
326
  render_revert_response if row_html_turbo_allowed?
325
327
  end
326
328
 
327
329
  private
328
330
 
331
+ # Undoing a parent +destroy+ reifies the Apartment/Photo row only. ActionText
332
+ # bodies live in +action_text_rich_texts+ and get their own PaperTrail
333
+ # +destroy+ versions; those rows are gone after +parent.destroy+, so we also
334
+ # reify and save each matching +ActionText::RichText+ destroy snapshot.
335
+ def restore_rich_texts_for_reverted_parent!(parent)
336
+ return unless defined?(ActionText::RichText)
337
+
338
+ record_type = parent.class.base_class.name
339
+ record_id = parent.id
340
+
341
+ PaperTrail::Version.where(item_type: "ActionText::RichText", event: "destroy").find_each do |version|
342
+ attrs = version.object_deserialized
343
+ next unless attrs.is_a?(Hash)
344
+
345
+ type = attrs["record_type"] || attrs[:record_type]
346
+ rid = attrs["record_id"] || attrs[:record_id]
347
+ next unless type == record_type && rid.to_i == record_id
348
+
349
+ rich_text = version.reify
350
+ rich_text&.save!
351
+ end
352
+ end
353
+
329
354
  # +revert+ is excluded from +load_and_authorize_resource+; +authorize!+ runs in the
330
355
  # action. +check_authorization+ on ApplicationController still requires that flag.
331
356
  def revert_authorization_subject(version)
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineForms
3
- VERSION = "8.1.13"
3
+ VERSION = "8.1.15"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.13
4
+ version: 8.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares