summaryrefslogtreecommitdiff
path: root/app/views/node_actions
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-16 03:30:01 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-16 03:30:01 +0200
commit190daaa8a0bb79e750894b83e31b9d99f7d900a4 (patch)
tree308a7bdeba7bd22733729408883e548f851a8812 /app/views/node_actions
parentc0c9250141c2fa64fed967b8b9ad9bada3694c3d (diff)
Add a reader for the action log at admin/log
NodeActionsController#index lists entries newest-first, filterable by node_id or user_id -- the two zoom shapes the log was designed around. Rendering goes through NodeActionsHelper.action_summary, which builds one sentence per entry from metadata alone, so entries referencing deleted users or nodes render from their snapshots; live associations only upgrade names to links. Unknown verbs degrade to a generic sentence rather than an error, since the log outlives its vocabulary. The helper is the escaping boundary: every metadata value passes through h() before assembly. Actor names link to the log's own user zoom rather than the unused users page -- inspecting a suspicious user's other actions is the intended workflow. Publish entries with a translation_diff expose a collapsed per-locale change table linking out to the revision itself. Sentences live in en.yml/de.yml following the existing widget-string convention. nodes#show links to its node's zoomed log.
Diffstat (limited to 'app/views/node_actions')
-rw-r--r--app/views/node_actions/_change_details.html.erb27
-rw-r--r--app/views/node_actions/index.html.erb22
2 files changed, 49 insertions, 0 deletions
diff --git a/app/views/node_actions/_change_details.html.erb b/app/views/node_actions/_change_details.html.erb
new file mode 100644
index 0000000..383f53a
--- /dev/null
+++ b/app/views/node_actions/_change_details.html.erb
@@ -0,0 +1,27 @@
1<details class="node_action_details">
2 <summary><%= t("node_actions.show_changes") %></summary>
3 <table>
4 <% action_entry.metadata["translation_diff"].each do |locale, diff| %>
5 <tr>
6 <th><%= locale.upcase %></th>
7 <td>
8 <% case diff["status"] %>
9 <% when "added" %>
10 <%= t("node_actions.locale_added", :title => diff.dig("title", "to")) %>
11 <% when "removed" %>
12 <%= t("node_actions.locale_removed", :title => diff.dig("title", "from")) %>
13 <% else %>
14 <% if diff["title"] %>
15 <%= diff.dig("title", "from") %> → <%= diff.dig("title", "to") %>
16 <% end %>
17 <%= t("node_actions.abstract_changed") if diff["abstract_changed"] %>
18 <%= t("node_actions.body_changed") if diff["body_changed"] %>
19 <% end %>
20 </td>
21 </tr>
22 <% end %>
23 </table>
24 <% if action_entry.page && action_entry.node %>
25 <%= link_to t("node_actions.view_revision"), node_revision_path(action_entry.node, action_entry.page) %>
26 <% end %>
27</details>
diff --git a/app/views/node_actions/index.html.erb b/app/views/node_actions/index.html.erb
new file mode 100644
index 0000000..92740cd
--- /dev/null
+++ b/app/views/node_actions/index.html.erb
@@ -0,0 +1,22 @@
1<h1><%= t("node_actions.heading") %></h1>
2
3<% if params[:node_id].present? || params[:user_id].present? %>
4 <p><%= link_to t("node_actions.show_all"), admin_log_path %></p>
5<% end %>
6
7<%= will_paginate @actions %>
8
9<ul id="node_action_list">
10 <% @actions.each do |action| %>
11 <li class="node_action node_action--<%= action.action %>">
12 <span class="node_action_time"><%= l(action.occurred_at, :format => :ccc) %></span>
13 <% if action.inferred_from %>
14 <span class="node_action_inferred" title="<%= action.inferred_from %>"><%= t("node_actions.backfilled") %></span>
15 <% end %>
16 <span class="node_action_summary"><%= action_summary(action) %></span>
17 <%= render "change_details", :action_entry => action if action.metadata["translation_diff"].present? %>
18 </li>
19 <% end %>
20</ul>
21
22<%= will_paginate @actions %>