From 8c978727c210da8558b15ee515b3b8824ff3a912 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 12 Aug 2024 20:10:09 -0400 Subject: [PATCH] MRF.QuietReply: add test for replies to unlisted posts --- .../web/activity_pub/mrf/quiet_reply_test.exs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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 35e321fd18..79e64d650c 100644 --- a/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs +++ b/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs @@ -50,6 +50,32 @@ test "replying to public post is forced to be quiet" do assert expected_cc == filtered["object"]["cc"] end + test "replying to unlisted post is unmodified" do + batman = insert(:user, nickname: "batman") + robin = insert(:user, nickname: "robin") + + {:ok, post} = CommonAPI.post(batman, %{status: "To the Batmobile!", visibility: "private"}) + + reply = %{ + "type" => "Create", + "actor" => robin.ap_id, + "to" => [batman.ap_id], + "cc" => [], + "object" => %{ + "type" => "Note", + "actor" => robin.ap_id, + "content" => "@batman Wait up, I forgot my spandex!", + "to" => [batman.ap_id], + "cc" => [], + "inReplyTo" => Object.normalize(post).data["id"] + } + } + + assert {:ok, filtered} = QuietReply.filter(reply) + + assert match?(^filtered, reply) + end + test "replying direct is unmodified" do batman = insert(:user, nickname: "batman") robin = insert(:user, nickname: "robin")