Remove conn from details_func invocation

This commit is contained in:
Luna D 2024-06-23 10:43:16 -04:00 committed by Liam
parent dfeefb1651
commit 6f0a2698f1

View file

@ -17,7 +17,7 @@ defmodule PhilomenaWeb.ModerationLogPlug do
def init(opts), do: opts def init(opts), do: opts
@type log_details :: %{subject_path: String.t(), body: String.t()} @type log_details :: %{subject_path: String.t(), body: String.t()}
@type details_func :: (Plug.Conn.t(), atom(), any() -> log_details()) @type details_func :: (atom(), any() -> log_details())
@type call_opts :: [details: details_func, data: any()] @type call_opts :: [details: details_func, data: any()]
@doc false @doc false
@ -29,7 +29,7 @@ defmodule PhilomenaWeb.ModerationLogPlug do
user = conn.assigns.current_user user = conn.assigns.current_user
action = Controller.action_name(conn) action = Controller.action_name(conn)
%{subject_path: subject_path, body: body} = details_func.(conn, action, userdata) %{subject_path: subject_path, body: body} = details_func.(action, userdata)
mod = Controller.controller_module(conn) mod = Controller.controller_module(conn)
[mod_name] = Regex.run(@controller_regex, to_string(mod), capture: :all_but_first) [mod_name] = Regex.run(@controller_regex, to_string(mod), capture: :all_but_first)