Improve readability
This commit is contained in:
parent
e2d358f1fb
commit
57878f8708
|
@ -7,9 +7,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy do
|
||||||
@behaviour Pleroma.Web.ActivityPub.MRF
|
@behaviour Pleroma.Web.ActivityPub.MRF
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def filter(%{"id" => id} = activity) do
|
def filter(activity) do
|
||||||
activity =
|
activity =
|
||||||
if String.starts_with?(id, Pleroma.Web.Endpoint.url()) do
|
if local?(activity) do
|
||||||
maybe_add_expiration(activity)
|
maybe_add_expiration(activity)
|
||||||
else
|
else
|
||||||
activity
|
activity
|
||||||
|
@ -21,6 +21,10 @@ def filter(%{"id" => id} = activity) do
|
||||||
@impl true
|
@impl true
|
||||||
def describe, do: {:ok, %{}}
|
def describe, do: {:ok, %{}}
|
||||||
|
|
||||||
|
defp local?(%{"id" => id}) do
|
||||||
|
String.starts_with?(id, Pleroma.Web.Endpoint.url())
|
||||||
|
end
|
||||||
|
|
||||||
defp maybe_add_expiration(activity) do
|
defp maybe_add_expiration(activity) do
|
||||||
days = Pleroma.Config.get([:mrf_activity_expiration, :days], 365)
|
days = Pleroma.Config.get([:mrf_activity_expiration, :days], 365)
|
||||||
expires_at = NaiveDateTime.utc_now() |> Timex.shift(days: days)
|
expires_at = NaiveDateTime.utc_now() |> Timex.shift(days: days)
|
||||||
|
|
Loading…
Reference in New Issue