diff options
author | kaniini <nenolod@gmail.com> | 2019-05-15 15:26:07 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-05-15 15:26:07 +0000 |
commit | 18f2d2024daa682cdb02c57eeb4c08d377a9a0a9 (patch) | |
tree | 78041b335925750f22126581bacbf03ccf3a17d1 /test/web/common_api/common_api_test.exs | |
parent | 0992094bd6bfca16f92fbc9f7f5f97c3d9088aa6 (diff) | |
parent | 7a92e701b974aa5ee70d617be323292c953d08de (diff) | |
download | pleroma-18f2d2024daa682cdb02c57eeb4c08d377a9a0a9.tar.gz |
Merge branch 'prevent-public-answers' into 'develop'
Prevent public answers to direct messages
See merge request pleroma/pleroma!1159
Diffstat (limited to 'test/web/common_api/common_api_test.exs')
-rw-r--r-- | test/web/common_api/common_api_test.exs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_test.exs b/test/web/common_api/common_api_test.exs index a5b07c446..8d4f401ee 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -87,6 +87,28 @@ defmodule Pleroma.Web.CommonAPITest do assert object.data["content"] == "<p><b>2hu</b></p>alert('xss')" end + + test "it does not allow replies to direct messages that are not direct messages themselves" do + user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "suya..", "visibility" => "direct"}) + + assert {:ok, _} = + CommonAPI.post(user, %{ + "status" => "suya..", + "visibility" => "direct", + "in_reply_to_status_id" => activity.id + }) + + Enum.each(["public", "private", "unlisted"], fn visibility -> + assert {:error, {:private_to_public, _}} = + CommonAPI.post(user, %{ + "status" => "suya..", + "visibility" => visibility, + "in_reply_to_status_id" => activity.id + }) + end) + end end describe "reactions" do |