From d85c7998e5faa0da53514bae8cc2ccb9a9fe0cd3 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Sat, 18 Jul 2026 02:16:23 +0200 Subject: Teach the action log reader the Trash vocabulary Sentences for trash (with the pre-trash path), restore_from_trash (with the destination), and destroy (with the final path, read from its flat create-symmetric key). --- app/helpers/node_actions_helper.rb | 15 +++++++++++++++ config/locales/de.yml | 3 +++ config/locales/en.yml | 3 +++ test/models/helpers/node_actions_helper_test.rb | 10 ++++++++++ 4 files changed, 31 insertions(+) diff --git a/app/helpers/node_actions_helper.rb b/app/helpers/node_actions_helper.rb index 996f98d..c829dff 100644 --- a/app/helpers/node_actions_helper.rb +++ b/app/helpers/node_actions_helper.rb @@ -114,4 +114,19 @@ module NodeActionsHelper t("node_actions.destroy_draft", :actor => actor_ref(action), :subject => subject_ref(action)).html_safe end + + def summarize_trash action + t("node_actions.trash", :actor => actor_ref(action), :subject => subject_ref(action), + :from => h(action.metadata.dig("path", "from"))).html_safe + end + + def summarize_restore_from_trash action + t("node_actions.restore_from_trash", :actor => actor_ref(action), :subject => subject_ref(action), + :to => h(action.metadata.dig("path", "to"))).html_safe + end + + def summarize_destroy action + t("node_actions.destroy", :actor => actor_ref(action), :subject => subject_ref(action), + :path => h(action.metadata["path"])).html_safe + end end diff --git a/config/locales/de.yml b/config/locales/de.yml index 8592364..289e5cc 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -110,3 +110,6 @@ de: detail_tags: "Tags %{from} → %{to}" template_changed: "Template geändert" assets_changed: "Bildliste geändert" + trash: "%{actor} hat %{subject} in den Papierkorb verschoben (vorher unter %{from})" + restore_from_trash: "%{actor} hat %{subject} aus dem Papierkorb nach %{to} wiederhergestellt" + destroy: "%{actor} hat %{subject} endgültig gelöscht (zuletzt unter %{path})" diff --git a/config/locales/en.yml b/config/locales/en.yml index f1856c1..b356cc1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -62,3 +62,6 @@ en: detail_tags: "tags %{from} → %{to}" template_changed: "template changed" assets_changed: "attached images changed" + trash: "%{actor} moved %{subject} to the Trash (was at %{from})" + restore_from_trash: "%{actor} restored %{subject} from the Trash to %{to}" + destroy: "%{actor} permanently deleted %{subject} (last at %{path})" diff --git a/test/models/helpers/node_actions_helper_test.rb b/test/models/helpers/node_actions_helper_test.rb index 5244c19..16c833b 100644 --- a/test/models/helpers/node_actions_helper_test.rb +++ b/test/models/helpers/node_actions_helper_test.rb @@ -104,4 +104,14 @@ class NodeActionsHelperTest < ActionView::TestCase assert_includes action_summary(e), "a/b" assert_not action_details?(e) end + + test "trash, restore, and destroy render their paths" do + trash = entry("trash", { "path" => { "from" => "club/old", "to" => "trash/old" } }) + restore = entry("restore_from_trash", { "path" => { "from" => "trash/old", "to" => "club/new" } }) + doomed = entry("destroy", { "path" => "trash/old" }) + + assert_includes action_summary(trash), "club/old" + assert_includes action_summary(restore), "club/new" + assert_includes action_summary(doomed), "trash/old" + end end -- cgit v1.3