aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTusooa Zhu <tusooa@kazv.moe>2022-07-23 22:34:03 -0400
committerTusooa Zhu <tusooa@kazv.moe>2022-07-23 22:34:03 -0400
commitdce7e429286dfe8cb44a27c50713a03f0e696357 (patch)
treeb07ea6c2a23c01921448c55dd9c205db7a2f5a0a /lib
parent0a337063e14a63b3ed80776b493e3c9c56dd95d1 (diff)
downloadpleroma-dce7e429286dfe8cb44a27c50713a03f0e696357.tar.gz
Make MediaProxyWarmingPolicy history-aware
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex b/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex
index 0eac8f021..c95d35bb9 100644
--- a/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex
+++ b/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex
@@ -16,6 +16,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy do
recv_timeout: 10_000
]
+ @impl true
+ def history_awareness, do: :auto
+
defp prefetch(url) do
# Fetching only proxiable resources
if MediaProxy.enabled?() and MediaProxy.url_proxiable?(url) do
@@ -54,10 +57,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy do
end
@impl true
- def filter(
- %{"type" => "Create", "object" => %{"attachment" => attachments} = _object} = message
- )
- when is_list(attachments) and length(attachments) > 0 do
+ def filter(%{"type" => type, "object" => %{"attachment" => attachments} = _object} = message)
+ when type in ["Create", "Update"] and is_list(attachments) and length(attachments) > 0 do
preload(message)
{:ok, message}