summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMint <mint@plagu.ee>2024-03-12 22:45:15 +0300
committerb <>2024-10-03 20:00:15 +0300
commitfd83b86b99ee6642fa0a765a55c0f0e35f272151 (patch)
tree25501f63e529e108d1b77b7c5ee0a0477528bbdf /test
parentb7c91876d2cc027a5a7f8a79ba256f13af623997 (diff)
downloadpleroma-fd83b86b99ee6642fa0a765a55c0f0e35f272151.tar.gz
pleroma-fd83b86b99ee6642fa0a765a55c0f0e35f272151.zip
RemoteReportPolicy: add `reject_third_party` option
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/activity_pub/mrf/remote_report_policy_test.exs48
1 files changed, 41 insertions, 7 deletions
diff --git a/test/pleroma/web/activity_pub/mrf/remote_report_policy_test.exs b/test/pleroma/web/activity_pub/mrf/remote_report_policy_test.exs
index 43258a7f6..dd56a1e9b 100644
--- a/test/pleroma/web/activity_pub/mrf/remote_report_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/remote_report_policy_test.exs
@@ -13,7 +13,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
- "actor" => "http://localhost:4001/actor"
+ "actor" => "http://localhost:4001/actor",
+ "object" => ["https://mastodon.online/users/Gargron"]
}
assert {:ok, _} = RemoteReportPolicy.filter(activity)
@@ -25,7 +26,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
- "actor" => "https://mastodon.social/actor"
+ "actor" => "https://mastodon.social/actor",
+ "object" => ["https://mastodon.online/users/Gargron"]
}
assert {:reject, _} = RemoteReportPolicy.filter(activity)
@@ -37,7 +39,34 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
- "actor" => "https://mastodon.social/actor"
+ "actor" => "https://mastodon.social/actor",
+ "object" => ["https://mastodon.online/users/Gargron"]
+ }
+
+ assert {:ok, _} = RemoteReportPolicy.filter(activity)
+ end
+
+ test "rejects report on third-party if `reject_third_party: true`" do
+ clear_config([:mrf_remote_report, :reject_third_party], true)
+ clear_config([:mrf_remote_report, :reject_empty_message], false)
+
+ activity = %{
+ "type" => "Flag",
+ "actor" => "https://mastodon.social/users/Gargron",
+ "object" => ["https://mastodon.online/users/Gargron"]
+ }
+
+ assert {:reject, _} = RemoteReportPolicy.filter(activity)
+ end
+
+ test "preserves report on third party if `reject_third_party: false`" do
+ clear_config([:mrf_remote_report, :reject_third_party], false)
+ clear_config([:mrf_remote_report, :reject_empty_message], false)
+
+ activity = %{
+ "type" => "Flag",
+ "actor" => "https://mastodon.social/users/Gargron",
+ "object" => ["https://mastodon.online/users/Gargron"]
}
assert {:ok, _} = RemoteReportPolicy.filter(activity)
@@ -49,7 +78,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
- "actor" => "https://mastodon.social/users/Gargron"
+ "actor" => "https://mastodon.social/users/Gargron",
+ "object" => ["https://mastodon.online/users/Gargron"]
}
assert {:reject, _} = RemoteReportPolicy.filter(activity)
@@ -62,6 +92,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
"actor" => "https://mastodon.social/users/Gargron",
+ "object" => ["https://mastodon.online/users/Gargron"],
"content" => ""
}
@@ -74,7 +105,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
- "actor" => "https://mastodon.social/users/Gargron"
+ "actor" => "https://mastodon.social/users/Gargron",
+ "object" => ["https://mastodon.online/users/Gargron"]
}
assert {:ok, _} = RemoteReportPolicy.filter(activity)
@@ -86,7 +118,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
- "actor" => "https://mastodon.social/actor"
+ "actor" => "https://mastodon.social/actor",
+ "object" => ["https://mastodon.online/users/Gargron"]
}
assert {:ok, _} = RemoteReportPolicy.filter(activity)
@@ -100,7 +133,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.RemoteReportPolicyTest do
activity = %{
"type" => "Flag",
"actor" => "https://mastodon.social/users/Gargron",
- "content" => "Transphobia"
+ "content" => "Transphobia",
+ "object" => ["https://mastodon.online/users/Gargron"]
}
assert {:reject, _} = RemoteReportPolicy.filter(activity)