aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIlja <pleroma@spectraltheorem.be>2020-04-20 12:59:16 +0000
committerlain <lain@soykaf.club>2020-04-20 12:59:16 +0000
commit8b4de61d6449f70e0a5e84be3082724c7f50ffee (patch)
tree618da8a23a12965123f9c7312093fcf623b743a9 /lib
parent918a8094fc175ed71ccb7305d606fb0b221163f6 (diff)
downloadpleroma-8b4de61d6449f70e0a5e84be3082724c7f50ffee.tar.gz
Fix ObjectAgePolicyTest
The policy didn't block old posts as it should. * I fixed it and tested on a test server * I added the settings to description so that this information is shown in nodeinfo * TODO: I didn't work TTD and still need to fix the tests
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/mrf/object_age_policy.ex10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex b/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex
index 4a8bc91ae..b0ccb63c8 100644
--- a/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex
+++ b/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex
@@ -11,7 +11,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
@moduledoc "Filter activities depending on their age"
@behaviour Pleroma.Web.ActivityPub.MRF
- defp check_date(%{"published" => published} = message) do
+ defp check_date(%{"object" => %{"published" => published}} = message) do
with %DateTime{} = now <- DateTime.utc_now(),
{:ok, %DateTime{} = then, _} <- DateTime.from_iso8601(published),
max_ttl <- Config.get([:mrf_object_age, :threshold]),
@@ -96,5 +96,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
def filter(message), do: {:ok, message}
@impl true
- def describe, do: {:ok, %{}}
+ def describe do
+ mrf_object_age =
+ Pleroma.Config.get(:mrf_object_age)
+ |> Enum.into(%{})
+
+ {:ok, %{mrf_object_age: mrf_object_age}}
+ end
end