From 0d2a8e4b61f4b79507519c73f127b7ab883d853c Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 24 Jul 2026 17:20:30 +0200 Subject: Render the otp verbs properly in the action log --- app/helpers/node_actions_helper.rb | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/helpers/node_actions_helper.rb b/app/helpers/node_actions_helper.rb index a4d13d22..4cbe741c 100644 --- a/app/helpers/node_actions_helper.rb +++ b/app/helpers/node_actions_helper.rb @@ -15,7 +15,10 @@ module NodeActionsHelper "destroy_draft" => "eraser", "asset_create" => "upload", "asset_attach" => "paperclip", - "asset_destroy" => "file-x" + "asset_destroy" => "file-x", + "otp_enroll" => "shield-lock", + "otp_disable" => "shield-off", + "otp_reset" => "shield-x" }.freeze def verb_icon action @@ -174,6 +177,12 @@ module NodeActionsHelper }, ", ") end + def user_participant_ref action + participant = action.action_participants.detect { |p| p.subject_type == "User" }&.subject + name = h(action.metadata["target_login"].presence || "unknown") + participant ? link_to(name, edit_user_path(participant)) : name + end + def summarize_publish action if action.metadata["via"] == "revision" t("node_actions.publish_rollback", @@ -249,4 +258,17 @@ module NodeActionsHelper :paths => h(Array(m["headline_removed_from"]).join(", "))) if m["headline_removed_from"].present? safe_join(parts, " ") end + + def summarize_otp_enroll action + t("node_actions.otp_enroll", :actor => actor_ref(action)).html_safe + end + + def summarize_otp_disable action + t("node_actions.otp_disable", :actor => actor_ref(action)).html_safe + end + + def summarize_otp_reset action + t("node_actions.otp_reset", :actor => actor_ref(action), + :target => user_participant_ref(action)).html_safe + end end -- cgit v1.3