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 +++++++++++++++++++++++- config/locales/de.yml | 3 +++ config/locales/en.yml | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) 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 diff --git a/config/locales/de.yml b/config/locales/de.yml index 7ffa0a59..ae955aa6 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -127,6 +127,9 @@ de: detail_assets_added: "Anhänge hinzugefügt: %{names}" detail_assets_removed: "Anhänge entfernt: %{names}" assets_reordered: "Anhänge umsortiert" + otp_enroll: "%{actor} hat einen zweiten Faktor eingerichtet" + otp_disable: "%{actor} hat den zweiten Faktor entfernt" + otp_reset: "%{actor} hat den zweiten Faktor von %{target} zurückgesetzt" open_gallery: "Gallerie anzeigen" asset_licenses: diff --git a/config/locales/en.yml b/config/locales/en.yml index 732d5cd1..618f5164 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -79,6 +79,9 @@ en: detail_assets_added: "Attachments added: %{names}" detail_assets_removed: "Attachments removed: %{names}" assets_reordered: "Attachments reordered" + otp_enroll: "%{actor} set up a second factor" + otp_disable: "%{actor} removed their second factor" + otp_reset: "%{actor} reset the second factor of %{target}" open_gallery: "Open gallery" asset_licenses: -- cgit v1.3