Make attachment cleanup jobs a noop if the setting is disabled.
This commit is contained in:
parent
7f07871639
commit
13d79c281f
@ -17,12 +17,14 @@ defmodule Pleroma.Workers.AttachmentsCleanupWorker do
|
|||||||
"object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}}
|
"object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}}
|
||||||
}
|
}
|
||||||
}) do
|
}) do
|
||||||
|
if Pleroma.Config.get([:instance, :cleanup_attachments], false) do
|
||||||
attachments
|
attachments
|
||||||
|> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
|
|> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
|
||||||
|> fetch_objects
|
|> fetch_objects
|
||||||
|> prepare_objects(actor, Enum.map(attachments, & &1["name"]))
|
|> prepare_objects(actor, Enum.map(attachments, & &1["name"]))
|
||||||
|> filter_objects
|
|> filter_objects
|
||||||
|> do_clean
|
|> do_clean
|
||||||
|
end
|
||||||
|
|
||||||
{:ok, :success}
|
{:ok, :success}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user