Prefer naming this put_application because we're putting it into the params map
This commit is contained in:
parent
09b8378646
commit
7c508319a5
@ -140,7 +140,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
|
|||||||
when not is_nil(scheduled_at) do
|
when not is_nil(scheduled_at) do
|
||||||
params =
|
params =
|
||||||
Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id])
|
Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id])
|
||||||
|> add_application(conn)
|
|> put_application(conn)
|
||||||
|
|
||||||
attrs = %{
|
attrs = %{
|
||||||
params: Map.new(params, fn {key, value} -> {to_string(key), value} end),
|
params: Map.new(params, fn {key, value} -> {to_string(key), value} end),
|
||||||
@ -169,7 +169,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
|
|||||||
) do
|
) do
|
||||||
params =
|
params =
|
||||||
Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id])
|
Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id])
|
||||||
|> add_application(conn)
|
|> put_application(conn)
|
||||||
|
|
||||||
with {:ok, activity} <- CommonAPI.post(user, params) do
|
with {:ok, activity} <- CommonAPI.post(user, params) do
|
||||||
try_render(conn, "show.json",
|
try_render(conn, "show.json",
|
||||||
@ -422,9 +422,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp add_application(params, %{assigns: %{token: %{app_id: app_id}}} = _conn) do
|
defp put_application(params, %{assigns: %{token: %{app_id: app_id}}} = _conn) do
|
||||||
params |> Map.put(:application, Pleroma.Web.OAuth.App.get_app_by_id(app_id))
|
params |> Map.put(:application, Pleroma.Web.OAuth.App.get_app_by_id(app_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
defp add_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil})
|
defp put_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user