diff options
Diffstat (limited to 'test/web/common_api')
| -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 11f3c8357..23e89d685 100644 --- a/test/web/common_api/common_api_test.exs +++ b/test/web/common_api/common_api_test.exs @@ -88,6 +88,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 +      test "it allows to address a list" do        user = insert(:user)        {:ok, list} = Pleroma.List.create("foo", user) | 
