diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-24 17:20:30 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-24 17:20:30 +0200 |
| commit | 0d2a8e4b61f4b79507519c73f127b7ab883d853c (patch) | |
| tree | d01e5b323be317d62a7e1bc14b997a9e81e4b462 /app/helpers/node_actions_helper.rb | |
| parent | 5f26394947d1150e2656bb22c5858ae5edcdcac7 (diff) | |
Render the otp verbs properly in the action log
Diffstat (limited to 'app/helpers/node_actions_helper.rb')
| -rw-r--r-- | app/helpers/node_actions_helper.rb | 24 |
1 files changed, 23 insertions, 1 deletions
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 | |||
| 15 | "destroy_draft" => "eraser", | 15 | "destroy_draft" => "eraser", |
| 16 | "asset_create" => "upload", | 16 | "asset_create" => "upload", |
| 17 | "asset_attach" => "paperclip", | 17 | "asset_attach" => "paperclip", |
| 18 | "asset_destroy" => "file-x" | 18 | "asset_destroy" => "file-x", |
| 19 | "otp_enroll" => "shield-lock", | ||
| 20 | "otp_disable" => "shield-off", | ||
| 21 | "otp_reset" => "shield-x" | ||
| 19 | }.freeze | 22 | }.freeze |
| 20 | 23 | ||
| 21 | def verb_icon action | 24 | def verb_icon action |
| @@ -174,6 +177,12 @@ module NodeActionsHelper | |||
| 174 | }, ", ") | 177 | }, ", ") |
| 175 | end | 178 | end |
| 176 | 179 | ||
| 180 | def user_participant_ref action | ||
| 181 | participant = action.action_participants.detect { |p| p.subject_type == "User" }&.subject | ||
| 182 | name = h(action.metadata["target_login"].presence || "unknown") | ||
| 183 | participant ? link_to(name, edit_user_path(participant)) : name | ||
| 184 | end | ||
| 185 | |||
| 177 | def summarize_publish action | 186 | def summarize_publish action |
| 178 | if action.metadata["via"] == "revision" | 187 | if action.metadata["via"] == "revision" |
| 179 | t("node_actions.publish_rollback", | 188 | t("node_actions.publish_rollback", |
| @@ -249,4 +258,17 @@ module NodeActionsHelper | |||
| 249 | :paths => h(Array(m["headline_removed_from"]).join(", "))) if m["headline_removed_from"].present? | 258 | :paths => h(Array(m["headline_removed_from"]).join(", "))) if m["headline_removed_from"].present? |
| 250 | safe_join(parts, " ") | 259 | safe_join(parts, " ") |
| 251 | end | 260 | end |
| 261 | |||
| 262 | def summarize_otp_enroll action | ||
| 263 | t("node_actions.otp_enroll", :actor => actor_ref(action)).html_safe | ||
| 264 | end | ||
| 265 | |||
| 266 | def summarize_otp_disable action | ||
| 267 | t("node_actions.otp_disable", :actor => actor_ref(action)).html_safe | ||
| 268 | end | ||
| 269 | |||
| 270 | def summarize_otp_reset action | ||
| 271 | t("node_actions.otp_reset", :actor => actor_ref(action), | ||
| 272 | :target => user_participant_ref(action)).html_safe | ||
| 273 | end | ||
| 252 | end | 274 | end |
