diff options
author | feld <feld@feld.me> | 2024-08-13 13:59:25 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2024-08-13 13:59:25 +0000 |
commit | 7388c4b5ca803ea29547619badb9a22c56643209 (patch) | |
tree | 5934742a275335d3318520cde24006b94bce5bc5 /test | |
parent | 4e7928c9850251f6d92409d5c6e97c7438499798 (diff) | |
parent | b0c64945c2cfd622b9f2c68d594bda4fd4c1b9eb (diff) | |
download | pleroma-7388c4b5ca803ea29547619badb9a22c56643209.tar.gz pleroma-7388c4b5ca803ea29547619badb9a22c56643209.zip |
Merge branch 'mrf-tests' into 'develop'
MRF.FODirectReply: use Visibility module to verify the scope
See merge request pleroma/pleroma!4218
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs | 30 | ||||
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs | 26 |
2 files changed, 56 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs b/test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs index 7afc83ffc..2d6af3b68 100644 --- a/test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs +++ b/test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs @@ -48,6 +48,36 @@ defmodule Pleroma.Web.ActivityPub.MRF.FODirectReplyTest do assert expected_cc == filtered["object"]["cc"] end + test "replies to unlisted posts are unmodified" do + batman = insert(:user, nickname: "batman") + robin = insert(:user, nickname: "robin") + + {:ok, post} = + CommonAPI.post(batman, %{ + status: "Has anyone seen Selina Kyle's latest selfies?", + visibility: "unlisted" + }) + + reply = %{ + "type" => "Create", + "actor" => robin.ap_id, + "to" => [batman.ap_id, robin.follower_address], + "cc" => [], + "object" => %{ + "type" => "Note", + "actor" => robin.ap_id, + "content" => "@batman 🤤 ❤️ 🐈<200d>⬛", + "to" => [batman.ap_id, robin.follower_address], + "cc" => [], + "inReplyTo" => Object.normalize(post).data["id"] + } + } + + assert {:ok, filtered} = FODirectReply.filter(reply) + + assert match?(^filtered, reply) + end + test "replies to public posts are unmodified" do batman = insert(:user, nickname: "batman") robin = insert(:user, nickname: "robin") 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 35e321fd1..79e64d650 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 @@ defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest 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") |