diff options
author | Mark Felder <feld@feld.me> | 2024-08-12 20:17:35 -0400 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2024-08-12 20:18:02 -0400 |
commit | b0c64945c2cfd622b9f2c68d594bda4fd4c1b9eb (patch) | |
tree | 5934742a275335d3318520cde24006b94bce5bc5 /test | |
parent | 8c978727c210da8558b15ee515b3b8824ff3a912 (diff) | |
download | pleroma-b0c64945c2cfd622b9f2c68d594bda4fd4c1b9eb.tar.gz pleroma-b0c64945c2cfd622b9f2c68d594bda4fd4c1b9eb.zip |
MRF.FODirectReply: use Visibility module to verify the scope
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs | 30 |
1 files changed, 30 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") |