aboutsummaryrefslogtreecommitdiff
path: root/test/web
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-03-20 21:09:36 +0100
committerlain <lain@soykaf.club>2019-03-20 21:09:36 +0100
commit8468f3f6d48693d2a27a257e5555aa71decff3df (patch)
tree9f61dcf50e315bba1842bda2e43d866adb7dbad7 /test/web
parent0d14def0ca781b79ffb3c1022472ac64f990cdf8 (diff)
downloadpleroma-8468f3f6d48693d2a27a257e5555aa71decff3df.tar.gz
Add safe dm mode option.
Diffstat (limited to 'test/web')
-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"})