Invalidation.enabled function is boolean
This commit is contained in:
parent
2222b21eb7
commit
acd7b7ada4
@ -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),
|
||||
|
@ -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}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user