Merge branch 'fix/attachment-cleanup' into 'develop'

Only run attachment cleanup if enabled

See merge request pleroma/pleroma!3288
This commit is contained in:
feld 2021-02-02 17:08:33 +00:00
commit 2012800ed1

View file

@ -17,12 +17,14 @@ def perform(%Job{
"object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}}
}
}) do
attachments
|> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
|> fetch_objects
|> prepare_objects(actor, Enum.map(attachments, & &1["name"]))
|> filter_objects
|> do_clean
if Pleroma.Config.get([:instance, :cleanup_attachments], false) do
attachments
|> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
|> fetch_objects
|> prepare_objects(actor, Enum.map(attachments, & &1["name"]))
|> filter_objects
|> do_clean
end
{:ok, :success}
end