Revert "Pleroma.Web.PleromaAPI.MascotController: dialyzer errors"

This reverts commit 9c8055d4b3.
This commit is contained in:
Mark Felder 2024-01-30 14:18:36 -05:00
parent b1a6102a85
commit 2c8e4f32c6
3 changed files with 4 additions and 5 deletions

View File

@ -51,7 +51,6 @@ defmodule Pleroma.Upload do
| {:size_limit, nil | non_neg_integer()} | {:size_limit, nil | non_neg_integer()}
| {:uploader, module()} | {:uploader, module()}
| {:filters, [module()]} | {:filters, [module()]}
| {:actor, String.t()}
@type t :: %__MODULE__{ @type t :: %__MODULE__{
id: String.t(), id: String.t(),

View File

@ -39,7 +39,7 @@ def update_operation do
%Schema{ %Schema{
type: :object, type: :object,
properties: %{ properties: %{
"file" => %Schema{type: :string, format: :binary} file: %Schema{type: :string, format: :binary}
} }
}, },
required: true required: true

View File

@ -22,9 +22,9 @@ def show(%{assigns: %{user: user}} = conn, _params) do
end end
@doc "PUT /api/v1/pleroma/mascot" @doc "PUT /api/v1/pleroma/mascot"
def update(%{assigns: %{user: user}, body_params: %{"file" => file}} = conn, _) do def update(%{assigns: %{user: user}, body_params: %{file: file}} = conn, _) do
with {_, "image" <> _} <- {:content_type, file.content_type}, with {:content_type, "image" <> _} <- {:content_type, file.content_type},
{_, {:ok, object}} <- {:upload, ActivityPub.upload(file, actor: User.ap_id(user))} do {:ok, object} <- ActivityPub.upload(file, actor: User.ap_id(user)) do
attachment = render_attachment(object) attachment = render_attachment(object)
{:ok, _user} = User.mascot_update(user, attachment) {:ok, _user} = User.mascot_update(user, attachment)