logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 5a134a46f7a59eba131c9e484d49e09394e341a8
parent d6cc6aff9b617a50679fe99d1533d2b3d118b656
Author: Mark Felder <feld@feld.me>
Date:   Thu,  8 Aug 2024 15:23:59 -0400

We must change to/cc in the activity and inner object

Diffstat:

Mlib/pleroma/web/activity_pub/mrf/quiet_reply.ex6++++--
Mtest/pleroma/web/activity_pub/mrf/quiet_reply_test.exs11+++++++++++
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 @@ -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 @@ -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,