diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-18 04:33:53 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-18 04:33:53 +0200 |
| commit | 49de2e14972030a7ef0ca36a94ab55a23a2f3596 (patch) | |
| tree | 7b05419a805e9bac01a4acea3ba6d0348af50ee6 /test | |
| parent | 10bd6ba5cc640f0a85a3adb3641a65ce5edf831d (diff) | |
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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/controllers/nodes_controller_test.rb | 12 | ||||
| -rw-r--r-- | test/models/helpers/node_actions_helper_test.rb | 19 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test/controllers/nodes_controller_test.rb b/test/controllers/nodes_controller_test.rb index 6e2ddb3..ddc4565 100644 --- a/test/controllers/nodes_controller_test.rb +++ b/test/controllers/nodes_controller_test.rb | |||
| @@ -745,4 +745,16 @@ class NodesControllerTest < ActionController::TestCase | |||
| 745 | assert_select "td", /quentin/ | 745 | assert_select "td", /quentin/ |
| 746 | assert_select "form[action=?]", node_path(node), count: 1 | 746 | assert_select "form[action=?]", node_path(node), count: 1 |
| 747 | end | 747 | end |
| 748 | |||
| 749 | test "show annotates history rows with their lifecycle" do | ||
| 750 | login_as :quentin | ||
| 751 | node = Node.root.children.create!(:slug => "history_annotation_test") | ||
| 752 | Globalize.with_locale(I18n.default_locale) { node.draft.update!(:title => "Annotated") } | ||
| 753 | node.publish_draft!(users(:quentin)) | ||
| 754 | |||
| 755 | get :show, params: { :id => node.id } | ||
| 756 | |||
| 757 | assert_response :success | ||
| 758 | assert_select "span.revision_lifecycle", /quentin/ | ||
| 759 | end | ||
| 748 | end | 760 | end |
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 | |||
| 114 | assert_includes action_summary(restore), "club/new" | 114 | assert_includes action_summary(restore), "club/new" |
| 115 | assert_includes action_summary(doomed), "trash/old" | 115 | assert_includes action_summary(doomed), "trash/old" |
| 116 | end | 116 | end |
| 117 | |||
| 118 | test "revision lifecycle badges cover create, publish, rollback, and inference" do | ||
| 119 | created = entry("create", { "title" => "x", "path" => "a/b" }) | ||
| 120 | published = entry("publish", { "via" => "draft", "title" => { "from" => nil, "to" => "x" } }) | ||
| 121 | restored = entry("publish", { "via" => "revision", "title" => { "from" => "y", "to" => "x" } }) | ||
| 122 | restored.update!(:inferred_from => "from_page_revision") | ||
| 123 | |||
| 124 | out = revision_lifecycle_badges([created, published, restored]) | ||
| 125 | |||
| 126 | assert_includes out, "created" | ||
| 127 | assert_includes out, "published" | ||
| 128 | assert_includes out, "restored" | ||
| 129 | assert_includes out, "quentin" | ||
| 130 | assert_includes out, "node_action_inferred" | ||
| 131 | assert_includes out, "<span" | ||
| 132 | assert_not_includes out, "<span" | ||
| 133 | |||
| 134 | assert_equal "", revision_lifecycle_badges(nil) | ||
| 135 | end | ||
| 117 | end | 136 | end |
