Pleroma.Web.PleromaAPI.EmojiPackController: fix dialyzer errors with replace_params: false
This commit is contained in:
parent
f1aeb80518
commit
9d16393d8b
|
@ -7,7 +7,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do
|
|||
|
||||
alias Pleroma.Emoji.Pack
|
||||
|
||||
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
||||
plug(Pleroma.Web.ApiSpec.CastAndValidate, replace_params: false)
|
||||
|
||||
plug(
|
||||
Pleroma.Web.Plugs.OAuthScopesPlug,
|
||||
|
@ -26,7 +26,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do
|
|||
|
||||
defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaEmojiPackOperation
|
||||
|
||||
def remote(conn, params) do
|
||||
def remote(%{private: %{open_api_spex: %{params: params}}} = conn, _) do
|
||||
with {:ok, packs} <-
|
||||
Pack.list_remote(url: params.url, page_size: params.page_size, page: params.page) do
|
||||
json(conn, packs)
|
||||
|
@ -38,7 +38,7 @@ def remote(conn, params) do
|
|||
end
|
||||
end
|
||||
|
||||
def index(conn, params) do
|
||||
def index(%{private: %{open_api_spex: %{params: params}}} = conn, _) do
|
||||
emoji_path =
|
||||
[:instance, :static_dir]
|
||||
|> Pleroma.Config.get!()
|
||||
|
@ -61,7 +61,11 @@ def index(conn, params) do
|
|||
end
|
||||
end
|
||||
|
||||
def show(conn, %{name: name, page: page, page_size: page_size}) do
|
||||
def show(
|
||||
%{private: %{open_api_spex: %{params: %{name: name, page: page, page_size: page_size}}}} =
|
||||
conn,
|
||||
_
|
||||
) do
|
||||
name = String.trim(name)
|
||||
|
||||
with {:ok, pack} <- Pack.show(name: name, page: page, page_size: page_size) do
|
||||
|
@ -90,7 +94,7 @@ def show(conn, %{name: name, page: page, page_size: page_size}) do
|
|||
end
|
||||
end
|
||||
|
||||
def archive(conn, %{name: name}) do
|
||||
def archive(%{private: %{open_api_spex: %{params: %{name: name}}}} = conn, _) do
|
||||
with {:ok, archive} <- Pack.get_archive(name) do
|
||||
send_download(conn, {:binary, archive}, filename: "#{name}.zip")
|
||||
else
|
||||
|
@ -109,7 +113,10 @@ def archive(conn, %{name: name}) do
|
|||
end
|
||||
end
|
||||
|
||||
def download(%{body_params: %{url: url, name: name} = params} = conn, _) do
|
||||
def download(
|
||||
%{private: %{open_api_spex: %{body_params: %{url: url, name: name} = params}}} = conn,
|
||||
_
|
||||
) do
|
||||
with {:ok, _pack} <- Pack.download(name, url, params[:as]) do
|
||||
json(conn, "ok")
|
||||
else
|
||||
|
@ -130,7 +137,7 @@ def download(%{body_params: %{url: url, name: name} = params} = conn, _) do
|
|||
end
|
||||
end
|
||||
|
||||
def create(conn, %{name: name}) do
|
||||
def create(%{private: %{open_api_spex: %{params: %{name: name}}}} = conn, _) do
|
||||
name = String.trim(name)
|
||||
|
||||
with {:ok, _pack} <- Pack.create(name) do
|
||||
|
@ -159,7 +166,7 @@ def create(conn, %{name: name}) do
|
|||
end
|
||||
end
|
||||
|
||||
def delete(conn, %{name: name}) do
|
||||
def delete(%{private: %{open_api_spex: %{params: %{name: name}}}} = conn, _) do
|
||||
name = String.trim(name)
|
||||
|
||||
with {:ok, deleted} when deleted != [] <- Pack.delete(name) do
|
||||
|
@ -184,7 +191,11 @@ def delete(conn, %{name: name}) do
|
|||
end
|
||||
end
|
||||
|
||||
def update(%{body_params: %{metadata: metadata}} = conn, %{name: name}) do
|
||||
def update(
|
||||
%{private: %{open_api_spex: %{body_params: %{metadata: metadata}, params: %{name: name}}}} =
|
||||
conn,
|
||||
_
|
||||
) do
|
||||
with {:ok, pack} <- Pack.update_metadata(name, metadata) do
|
||||
json(conn, pack.pack)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue