mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-22 17:27:18 +00:00
Merge branch 'bugfix/object-age-create' into 'develop'
ObjectAgePolicy: Fix pattern matching on published See merge request pleroma/pleroma!3500
This commit is contained in:
commit
8679a57a71
|
@ -49,6 +49,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
|
||||||
message
|
message
|
||||||
|> Map.put("to", to)
|
|> Map.put("to", to)
|
||||||
|> Map.put("cc", cc)
|
|> Map.put("cc", cc)
|
||||||
|
|> Kernel.put_in(["object", "to"], to)
|
||||||
|
|> Kernel.put_in(["object", "cc"], cc)
|
||||||
|
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
|
@ -70,6 +72,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
|
||||||
message
|
message
|
||||||
|> Map.put("to", to)
|
|> Map.put("to", to)
|
||||||
|> Map.put("cc", cc)
|
|> Map.put("cc", cc)
|
||||||
|
|> Kernel.put_in(["object", "to"], to)
|
||||||
|
|> Kernel.put_in(["object", "cc"], cc)
|
||||||
|
|
||||||
{:ok, message}
|
{:ok, message}
|
||||||
else
|
else
|
||||||
|
@ -82,7 +86,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def filter(%{"type" => "Create", "published" => _} = message) do
|
def filter(%{"type" => "Create", "object" => %{"published" => _}} = message) do
|
||||||
with actions <- Config.get([:mrf_object_age, :actions]),
|
with actions <- Config.get([:mrf_object_age, :actions]),
|
||||||
{:reject, _} <- check_date(message),
|
{:reject, _} <- check_date(message),
|
||||||
{:ok, message} <- check_reject(message, actions),
|
{:ok, message} <- check_reject(message, actions),
|
||||||
|
|
|
@ -22,6 +22,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
|
||||||
defp get_old_message do
|
defp get_old_message do
|
||||||
File.read!("test/fixtures/mastodon-post-activity.json")
|
File.read!("test/fixtures/mastodon-post-activity.json")
|
||||||
|> Jason.decode!()
|
|> Jason.decode!()
|
||||||
|
|> Map.drop(["published"])
|
||||||
end
|
end
|
||||||
|
|
||||||
defp get_new_message do
|
defp get_new_message do
|
||||||
|
|
Loading…
Reference in a new issue