From 2c8e4f32c60793aba3e048f4d1c2b30186eb22af Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 30 Jan 2024 14:18:36 -0500 Subject: [PATCH] Revert "Pleroma.Web.PleromaAPI.MascotController: dialyzer errors" This reverts commit 9c8055d4b3eeed04e2fc27b69e1bd2b8bae11bb8. --- lib/pleroma/upload.ex | 1 - .../web/api_spec/operations/pleroma_mascot_operation.ex | 2 +- .../web/pleroma_api/controllers/mascot_controller.ex | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index e6c484548..89cd3d920 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -51,7 +51,6 @@ defmodule Pleroma.Upload do | {:size_limit, nil | non_neg_integer()} | {:uploader, module()} | {:filters, [module()]} - | {:actor, String.t()} @type t :: %__MODULE__{ id: String.t(), diff --git a/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex index 49c50751b..775e27219 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex @@ -39,7 +39,7 @@ defmodule Pleroma.Web.ApiSpec.PleromaMascotOperation do %Schema{ type: :object, properties: %{ - "file" => %Schema{type: :string, format: :binary} + file: %Schema{type: :string, format: :binary} } }, required: true diff --git a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex index 0533c348c..2b6093753 100644 --- a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex @@ -22,9 +22,9 @@ defmodule Pleroma.Web.PleromaAPI.MascotController do end @doc "PUT /api/v1/pleroma/mascot" - def update(%{assigns: %{user: user}, body_params: %{"file" => file}} = conn, _) do - with {_, "image" <> _} <- {:content_type, file.content_type}, - {_, {:ok, object}} <- {:upload, ActivityPub.upload(file, actor: User.ap_id(user))} do + def update(%{assigns: %{user: user}, body_params: %{file: file}} = conn, _) do + with {:content_type, "image" <> _} <- {:content_type, file.content_type}, + {:ok, object} <- ActivityPub.upload(file, actor: User.ap_id(user)) do attachment = render_attachment(object) {:ok, _user} = User.mascot_update(user, attachment)