From 49de2e14972030a7ef0ca36a94ab55a23a2f3596 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 18 Jul 2026 04:33:53 +0200 Subject: Annotate the History list with each revision's lifecycle Each row in nodes#show's History section now carries terse badges from the action log: created, published, and restored (rollback re-promotion), with date and actor, rendered from entry metadata alone. Backfilled entries wear the inferred marker, so reconstructed provenance stays distinguishable from witnessed history. A revision that was published and later restored shows both badges chronologically -- its true biography. Only create and publish entries carry page_id; trash, restore, and destroy annotate the node's own log zoom instead of any single revision, by design. --- test/models/helpers/node_actions_helper_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/models') diff --git a/test/models/helpers/node_actions_helper_test.rb b/test/models/helpers/node_actions_helper_test.rb index 16c833b..ef6035d 100644 --- a/test/models/helpers/node_actions_helper_test.rb +++ b/test/models/helpers/node_actions_helper_test.rb @@ -114,4 +114,23 @@ class NodeActionsHelperTest < ActionView::TestCase assert_includes action_summary(restore), "club/new" assert_includes action_summary(doomed), "trash/old" end + + test "revision lifecycle badges cover create, publish, rollback, and inference" do + created = entry("create", { "title" => "x", "path" => "a/b" }) + published = entry("publish", { "via" => "draft", "title" => { "from" => nil, "to" => "x" } }) + restored = entry("publish", { "via" => "revision", "title" => { "from" => "y", "to" => "x" } }) + restored.update!(:inferred_from => "from_page_revision") + + out = revision_lifecycle_badges([created, published, restored]) + + assert_includes out, "created" + assert_includes out, "published" + assert_includes out, "restored" + assert_includes out, "quentin" + assert_includes out, "node_action_inferred" + assert_includes out, "