diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index c08066046..a87a6d946 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -277,7 +277,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do _ <- increase_replies_count_if_reply(create_data), _ <- increase_poll_votes_if_vote(create_data), _ <- - maybe_remove_mediaproxy_invalidation(MediaProxy.Invalidation.enabled(), create_data), + maybe_remove_mediaproxy_invalidation(MediaProxy.Invalidation.enabled?(), create_data), {:quick_insert, false, activity} <- {:quick_insert, quick_insert?, activity}, {:ok, _actor} <- increase_note_count_if_public(actor, activity), _ <- notify_and_stream(activity), diff --git a/lib/pleroma/web/media_proxy/invalidation.ex b/lib/pleroma/web/media_proxy/invalidation.ex index fac731c5c..83ff8589c 100644 --- a/lib/pleroma/web/media_proxy/invalidation.ex +++ b/lib/pleroma/web/media_proxy/invalidation.ex @@ -10,13 +10,14 @@ defmodule Pleroma.Web.MediaProxy.Invalidation do alias Pleroma.Config alias Pleroma.Web.MediaProxy - def enabled, do: Config.get([:media_proxy, :invalidation, :enabled]) + @spec enabled?() :: boolean() + def enabled?, do: Config.get([:media_proxy, :invalidation, :enabled]) @spec purge(list(String.t()) | String.t()) :: {:ok, list(String.t())} | {:error, String.t()} def purge(urls) do prepared_urls = prepare_urls(urls) - if enabled() do + if enabled?() do do_purge(prepared_urls) else {:ok, prepared_urls} diff --git a/lib/pleroma/workers/attachments_cleanup_worker.ex b/lib/pleroma/workers/attachments_cleanup_worker.ex index 4a7b67080..24694cc67 100644 --- a/lib/pleroma/workers/attachments_cleanup_worker.ex +++ b/lib/pleroma/workers/attachments_cleanup_worker.ex @@ -52,7 +52,7 @@ defmodule Pleroma.Workers.AttachmentsCleanupWorker do end end) - lock_attachments(MediaProxy.Invalidation.enabled(), hrefs -- exclude_urls) + lock_attachments(MediaProxy.Invalidation.enabled?(), hrefs -- exclude_urls) Enum.each(attachment_urls, fn href -> href @@ -62,7 +62,7 @@ defmodule Pleroma.Workers.AttachmentsCleanupWorker do delete_objects(object_ids) - cache_purge(MediaProxy.Invalidation.enabled(), hrefs -- exclude_urls) + cache_purge(MediaProxy.Invalidation.enabled?(), hrefs -- exclude_urls) {:ok, :success} end