summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkaniini <ariadne@dereferenced.org>2019-09-23 22:35:09 +0000
committerkaniini <ariadne@dereferenced.org>2019-09-23 22:35:09 +0000
commit760df67a7b767d113a0ff2b351f872caf8751832 (patch)
tree107f330f662bb94250e2d1531713110a07711f37 /test
parentad9595ca55ef231a7018f84422b4d7360593833f (diff)
parent7cf125245512eb49a118535eda52ddbdd0c4c6bf (diff)
downloadpleroma-760df67a7b767d113a0ff2b351f872caf8751832.tar.gz
pleroma-760df67a7b767d113a0ff2b351f872caf8751832.zip
Merge branch 'remove-direct-messages-from-public-timeline' into 'develop'
Fix private and direct statuses not being filtered out from the public timeline for an authenticated user. Closes #1223 See merge request pleroma/pleroma!1703
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs16
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)