From 5a134a46f7a59eba131c9e484d49e09394e341a8 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 8 Aug 2024 15:23:59 -0400 Subject: [PATCH] We must change to/cc in the activity and inner object --- lib/pleroma/web/activity_pub/mrf/quiet_reply.ex | 6 ++++-- .../pleroma/web/activity_pub/mrf/quiet_reply_test.exs | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/quiet_reply.ex b/lib/pleroma/web/activity_pub/mrf/quiet_reply.ex index 8a9b2beb8..52d92f267 100644 --- a/lib/pleroma/web/activity_pub/mrf/quiet_reply.ex +++ b/lib/pleroma/web/activity_pub/mrf/quiet_reply.ex @@ -16,11 +16,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReply do def filter( %{ "type" => "Create", + "to" => to, + "cc" => cc, "object" => %{ "actor" => actor, "type" => "Note", - "to" => to, - "cc" => cc, "inReplyTo" => in_reply_to } } = object @@ -38,6 +38,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReply do updated_object = object + |> Map.put("to", updated_to) + |> Map.put("cc", updated_cc) |> put_in(["object", "to"], updated_to) |> put_in(["object", "cc"], updated_cc) diff --git a/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs b/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs index e2b3ce439..35e321fd1 100644 --- a/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs +++ b/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs @@ -21,6 +21,11 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do reply = %{ "type" => "Create", "actor" => robin.ap_id, + "to" => [ + batman.ap_id, + Pleroma.Constants.as_public() + ], + "cc" => [robin.follower_address], "object" => %{ "type" => "Note", "actor" => robin.ap_id, @@ -39,6 +44,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do assert {:ok, filtered} = QuietReply.filter(reply) + assert expected_to == filtered["to"] + assert expected_cc == filtered["cc"] assert expected_to == filtered["object"]["to"] assert expected_cc == filtered["object"]["cc"] end @@ -52,6 +59,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do reply = %{ "type" => "Create", "actor" => robin.ap_id, + "to" => [batman.ap_id], + "cc" => [], "object" => %{ "type" => "Note", "actor" => robin.ap_id, @@ -76,6 +85,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do reply = %{ "type" => "Create", "actor" => robin.ap_id, + "to" => [batman.ap_id, robin.follower_address], + "cc" => [], "object" => %{ "type" => "Note", "actor" => robin.ap_id,