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