Pleroma.Object: dialyzer error

lib/pleroma/object.ex:245:call
The function call will not succeed.

Pleroma.Object.cleanup_attachments(any(), %{<<_::48>> => %Pleroma.Object{:data => map(), atom() => _}})

breaks the contract
(boolean(), %{:object => map()}) :: {:ok, Oban.Job.t() | nil}
This commit is contained in:
Mark Felder 2024-01-27 13:58:50 -05:00
parent 2062e126f1
commit 948d5a93a0
1 changed files with 4 additions and 4 deletions

View File

@ -242,17 +242,17 @@ def delete(%Object{data: %{"id" => id}} = object) do
{:ok, _} <- invalid_object_cache(object) do {:ok, _} <- invalid_object_cache(object) do
cleanup_attachments( cleanup_attachments(
Config.get([:instance, :cleanup_attachments]), Config.get([:instance, :cleanup_attachments]),
%{"object" => object} object
) )
{:ok, object, deleted_activity} {:ok, object, deleted_activity}
end end
end end
@spec cleanup_attachments(boolean(), %{required(:object) => map()}) :: @spec cleanup_attachments(boolean(), Object.t()) ::
{:ok, Oban.Job.t() | nil} {:ok, Oban.Job.t() | nil}
def cleanup_attachments(true, %{"object" => _} = params) do def cleanup_attachments(true, %Object{} = object) do
AttachmentsCleanupWorker.enqueue("cleanup_attachments", params) AttachmentsCleanupWorker.enqueue("cleanup_attachments", %{"object" => object})
end end
def cleanup_attachments(_, _), do: {:ok, nil} def cleanup_attachments(_, _), do: {:ok, nil}