summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2025-02-28 16:40:38 -0800
committerMark Felder <feld@feld.me>2025-02-28 16:43:28 -0800
commit2c9d071aadde88e8ab615be6654e237ae01decb7 (patch)
treec189e9325782f602fddd499a2ef0fe108dc7b17f /test
parent63663ac88bae834621417a1084e507831a44e7e2 (diff)
downloadpleroma-2c9d071aadde88e8ab615be6654e237ae01decb7.tar.gz
pleroma-2c9d071aadde88e8ab615be6654e237ae01decb7.zip
Retire MRFs DNSRBL, FODirectReply, and QuietReply
DNSRBL was a neat experiment which should live out of tree. It works and could be used to coordinate rules across different servers, but Simple Policy will always be better FODirectReply and QuietReply have reliability issues as implemented in an MRF. If we want to expose this functionality to admins it should be a setting that overrides the chosen scope during CommonAPI.post instead of trying to rewrite the recipients with an MRF.
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs117
-rw-r--r--test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs140
2 files changed, 0 insertions, 257 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
deleted file mode 100644
index 2d6af3b68..000000000
--- a/test/pleroma/web/activity_pub/mrf/fo_direct_reply_test.exs
+++ /dev/null
@@ -1,117 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ActivityPub.MRF.FODirectReplyTest do
- use Pleroma.DataCase
- import Pleroma.Factory
-
- require Pleroma.Constants
-
- alias Pleroma.Object
- alias Pleroma.Web.ActivityPub.MRF.FODirectReply
- alias Pleroma.Web.CommonAPI
-
- test "replying to followers-only/private is changed to direct" 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: "private"
- })
-
- reply = %{
- "type" => "Create",
- "actor" => robin.ap_id,
- "to" => [batman.ap_id, robin.follower_address],
- "cc" => [],
- "object" => %{
- "type" => "Note",
- "actor" => robin.ap_id,
- "content" => "@batman 🤤 ❤️ 🐈‍⬛",
- "to" => [batman.ap_id, robin.follower_address],
- "cc" => [],
- "inReplyTo" => Object.normalize(post).data["id"]
- }
- }
-
- expected_to = [batman.ap_id]
- expected_cc = []
-
- assert {:ok, filtered} = FODirectReply.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
-
- 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")
-
- {:ok, post} =
- CommonAPI.post(batman, %{status: "Has anyone seen Selina Kyle's latest selfies?"})
-
- 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 "non-reply posts are unmodified" do
- batman = insert(:user, nickname: "batman")
-
- {:ok, post} = CommonAPI.post(batman, %{status: "To the Batmobile!"})
-
- assert {:ok, filtered} = FODirectReply.filter(post)
-
- assert match?(^filtered, post)
- end
-end
diff --git a/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs b/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs
deleted file mode 100644
index 79e64d650..000000000
--- a/test/pleroma/web/activity_pub/mrf/quiet_reply_test.exs
+++ /dev/null
@@ -1,140 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.ActivityPub.MRF.QuietReplyTest do
- use Pleroma.DataCase
- import Pleroma.Factory
-
- require Pleroma.Constants
-
- alias Pleroma.Object
- alias Pleroma.Web.ActivityPub.MRF.QuietReply
- alias Pleroma.Web.CommonAPI
-
- test "replying to public post is forced to be quiet" do
- batman = insert(:user, nickname: "batman")
- robin = insert(:user, nickname: "robin")
-
- {:ok, post} = CommonAPI.post(batman, %{status: "To the Batmobile!"})
-
- 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,
- "content" => "@batman Wait up, I forgot my spandex!",
- "to" => [
- batman.ap_id,
- Pleroma.Constants.as_public()
- ],
- "cc" => [robin.follower_address],
- "inReplyTo" => Object.normalize(post).data["id"]
- }
- }
-
- expected_to = [batman.ap_id, robin.follower_address]
- expected_cc = [Pleroma.Constants.as_public()]
-
- 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
-
- 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")
-
- {:ok, post} = CommonAPI.post(batman, %{status: "To the Batmobile!"})
-
- 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 followers-only is unmodified" do
- batman = insert(:user, nickname: "batman")
- robin = insert(:user, nickname: "robin")
-
- {:ok, post} = CommonAPI.post(batman, %{status: "To the Batmobile!"})
-
- reply = %{
- "type" => "Create",
- "actor" => robin.ap_id,
- "to" => [batman.ap_id, robin.follower_address],
- "cc" => [],
- "object" => %{
- "type" => "Note",
- "actor" => robin.ap_id,
- "content" => "@batman Wait up, I forgot my spandex!",
- "to" => [batman.ap_id, robin.follower_address],
- "cc" => [],
- "inReplyTo" => Object.normalize(post).data["id"]
- }
- }
-
- assert {:ok, filtered} = QuietReply.filter(reply)
-
- assert match?(^filtered, reply)
- end
-
- test "non-reply posts are unmodified" do
- batman = insert(:user, nickname: "batman")
-
- {:ok, post} = CommonAPI.post(batman, %{status: "To the Batmobile!"})
-
- assert {:ok, filtered} = QuietReply.filter(post)
-
- assert match?(^filtered, post)
- end
-end