logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 13d79c281fd09d3f9dad802e6c11722bc75ed746
parent 7f0787163999fc0ac0c6fcfd0c13f80c5a55266d
Author: Mark Felder <feld@feld.me>
Date:   Thu, 28 Jan 2021 14:42:20 -0600

Make attachment cleanup jobs a noop if the setting is disabled.

Diffstat:

Mlib/pleroma/workers/attachments_cleanup_worker.ex14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/pleroma/workers/attachments_cleanup_worker.ex b/lib/pleroma/workers/attachments_cleanup_worker.ex @@ -17,12 +17,14 @@ defmodule Pleroma.Workers.AttachmentsCleanupWorker do "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