diff options
author | eugenijm <eugenijm@protonmail.com> | 2019-09-20 17:54:38 +0300 |
---|---|---|
committer | eugenijm <eugenijm@protonmail.com> | 2019-09-20 18:27:00 +0300 |
commit | 7cf125245512eb49a118535eda52ddbdd0c4c6bf (patch) | |
tree | dc53767fa44fb4e50b360c2f7fcab0f50f1ba91b /test | |
parent | c4da7499a3d7b0f5086c1180131df4e35b5b0d15 (diff) | |
download | pleroma-7cf125245512eb49a118535eda52ddbdd0c4c6bf.tar.gz pleroma-7cf125245512eb49a118535eda52ddbdd0c4c6bf.zip |
Mastodon API: Fix private and direct statuses not being filtered out from the public timeline for an authenticated user (`GET /api/v1/timelines/public`)
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/mastodon_api_controller_test.exs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 35a0d3fe1..51f5215c2 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -97,6 +97,22 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do |> json_response(403) == %{"error" => "This resource requires authentication."} end + test "the public timeline includes only public statuses for an authenticated user" do + user = insert(:user) + + conn = + build_conn() + |> assign(:user, user) + + {:ok, _activity} = CommonAPI.post(user, %{"status" => "test"}) + {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "private"}) + {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "unlisted"}) + {:ok, _activity} = CommonAPI.post(user, %{"status" => "test", "visibility" => "direct"}) + + res_conn = get(conn, "/api/v1/timelines/public") + assert length(json_response(res_conn, 200)) == 1 + end + describe "posting statuses" do setup do user = insert(:user) |