forked from AkkomaGang/akkoma
Merge branch 'fix/attachment-cleanup' into 'develop'
Only run attachment cleanup if enabled See merge request pleroma/pleroma!3288
This commit is contained in:
commit
2012800ed1
1 changed files with 8 additions and 6 deletions
|
@ -17,12 +17,14 @@ def perform(%Job{
|
||||||
"object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}}
|
"object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}}
|
||||||
}
|
}
|
||||||
}) do
|
}) do
|
||||||
attachments
|
if Pleroma.Config.get([:instance, :cleanup_attachments], false) do
|
||||||
|> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
|
attachments
|
||||||
|> fetch_objects
|
|> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end)
|
||||||
|> prepare_objects(actor, Enum.map(attachments, & &1["name"]))
|
|> fetch_objects
|
||||||
|> filter_objects
|
|> prepare_objects(actor, Enum.map(attachments, & &1["name"]))
|
||||||
|> do_clean
|
|> filter_objects
|
||||||
|
|> do_clean
|
||||||
|
end
|
||||||
|
|
||||||
{:ok, :success}
|
{:ok, :success}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue