aboutsummaryrefslogtreecommitdiff
path: root/test/web/common_api
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2019-03-22 00:50:24 +0000
committerkaniini <nenolod@gmail.com>2019-03-22 00:50:24 +0000
commit1c3d3d0c2b6ebb4948df0b4ec085bcc4a564a126 (patch)
treeda2492e2a4d7e1202e82bff3fbe4d89ddd8b85c5 /test/web/common_api
parentb548181b52c4397d5034cfd95b2ef7e05c9c9c22 (diff)
parentbf27190f7f0942a05de518f2085a299eb011614c (diff)
downloadpleroma-1c3d3d0c2b6ebb4948df0b4ec085bcc4a564a126.tar.gz
Merge branch 'safe-mentions' into 'develop'
Add safe dm mode option. See merge request pleroma/pleroma!958
Diffstat (limited to 'test/web/common_api')
-rw-r--r--test/web/common_api/common_api_test.exs18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs
index f83f80b40..34aa5bf18 100644
--- a/test/web/common_api/common_api_test.exs
+++ b/test/web/common_api/common_api_test.exs
@@ -10,6 +10,24 @@ defmodule Pleroma.Web.CommonAPITest do
import Pleroma.Factory
+ test "with the safe_dm_mention option set, it does not mention people beyond the initial tags" do
+ har = insert(:user)
+ jafnhar = insert(:user)
+ tridi = insert(:user)
+ option = Pleroma.Config.get([:instance, :safe_dm_mentions])
+ Pleroma.Config.put([:instance, :safe_dm_mentions], true)
+
+ {:ok, activity} =
+ CommonAPI.post(har, %{
+ "status" => "@#{jafnhar.nickname} hey, i never want to see @#{tridi.nickname} again",
+ "visibility" => "direct"
+ })
+
+ refute tridi.ap_id in activity.recipients
+ assert jafnhar.ap_id in activity.recipients
+ Pleroma.Config.put([:instance, :safe_dm_mentions], option)
+ end
+
test "it de-duplicates tags" do
user = insert(:user)
{:ok, activity} = CommonAPI.post(user, %{"status" => "#2hu #2HU"})