Log DNP entry transitions

This commit is contained in:
mdashlw 2025-03-23 09:45:05 +00:00 committed by GitHub
parent 8af67ab63a
commit f68b94594f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,6 +16,7 @@ defmodule PhilomenaWeb.Admin.DnpEntry.TransitionController do
{:ok, dnp_entry} ->
conn
|> put_flash(:info, "Successfully updated DNP entry.")
|> moderation_log(details: &log_details/2, data: dnp_entry)
|> redirect(to: ~p"/dnp/#{dnp_entry}")
{:error, _changeset} ->
@ -31,4 +32,11 @@ defmodule PhilomenaWeb.Admin.DnpEntry.TransitionController do
_false -> PhilomenaWeb.NotAuthorizedPlug.call(conn)
end
end
defp log_details(_action, dnp_entry) do
%{
body: "#{String.capitalize(dnp_entry.aasm_state)} DNP entry #{dnp_entry.id}",
subject_path: ~p"/dnp/#{dnp_entry}"
}
end
end