mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-04-05 02:59:40 +02:00
Preload tag in dnp transition controller
This commit is contained in:
parent
f68b94594f
commit
21e853017a
1 changed files with 9 additions and 2 deletions
|
@ -5,7 +5,13 @@ defmodule PhilomenaWeb.Admin.DnpEntry.TransitionController do
|
|||
alias Philomena.DnpEntries
|
||||
|
||||
plug :verify_authorized
|
||||
plug :load_resource, model: DnpEntry, only: [:create], id_name: "dnp_entry_id", persisted: true
|
||||
|
||||
plug :load_resource,
|
||||
model: DnpEntry,
|
||||
only: [:create],
|
||||
id_name: "dnp_entry_id",
|
||||
preload: [:tag],
|
||||
persisted: true
|
||||
|
||||
def create(conn, %{"state" => new_state}) do
|
||||
case DnpEntries.transition_dnp_entry(
|
||||
|
@ -35,7 +41,8 @@ defmodule PhilomenaWeb.Admin.DnpEntry.TransitionController do
|
|||
|
||||
defp log_details(_action, dnp_entry) do
|
||||
%{
|
||||
body: "#{String.capitalize(dnp_entry.aasm_state)} DNP entry #{dnp_entry.id}",
|
||||
body:
|
||||
"#{String.capitalize(dnp_entry.aasm_state)} DNP entry #{dnp_entry.id} on #{dnp_entry.tag.name}",
|
||||
subject_path: ~p"/dnp/#{dnp_entry}"
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue