diff options
author | rinpatch <rinpatch@sdf.org> | 2020-06-01 20:45:59 +0000 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-06-01 20:45:59 +0000 |
commit | d67b8a96c77c5c3a9b3fe2e5f3b344f19af16ce8 (patch) | |
tree | 64670e22bf73edb2498b69ba3c80962d3001a900 | |
parent | fa37bfff99b3d4277a14345cff4ccbbe93385e04 (diff) | |
parent | d4d4b92f758979fbc22cd56a9f30435df5c40ab6 (diff) | |
download | pleroma-d67b8a96c77c5c3a9b3fe2e5f3b344f19af16ce8.tar.gz |
Merge branch 'only-creates-in-public-tl' into 'develop'
TimelineController: Only return `Create` in public timelines.
Closes #1833 and #1821
See merge request pleroma/pleroma!2618
-rw-r--r-- | lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex | 2 | ||||
-rw-r--r-- | test/web/mastodon_api/controllers/timeline_controller_test.exs | 11 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 958567510..f67f75430 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -111,7 +111,7 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do else activities = params - |> Map.put("type", ["Create", "Announce"]) + |> Map.put("type", ["Create"]) |> Map.put("local_only", local_only) |> Map.put("blocking_user", user) |> Map.put("muting_user", user) diff --git a/test/web/mastodon_api/controllers/timeline_controller_test.exs b/test/web/mastodon_api/controllers/timeline_controller_test.exs index 2375ac8e8..65b4079fe 100644 --- a/test/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/web/mastodon_api/controllers/timeline_controller_test.exs @@ -60,9 +60,9 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do describe "public" do @tag capture_log: true test "the public timeline", %{conn: conn} do - following = insert(:user) + user = insert(:user) - {:ok, _activity} = CommonAPI.post(following, %{status: "test"}) + {:ok, activity} = CommonAPI.post(user, %{status: "test"}) _activity = insert(:note_activity, local: false) @@ -77,6 +77,13 @@ defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do conn = get(build_conn(), "/api/v1/timelines/public?local=1") assert [%{"content" => "test"}] = json_response_and_validate_schema(conn, :ok) + + # does not contain repeats + {:ok, _} = CommonAPI.repeat(activity.id, user) + + conn = get(build_conn(), "/api/v1/timelines/public?local=true") + + assert [_] = json_response_and_validate_schema(conn, :ok) end test "the public timeline includes only public statuses for an authenticated user" do |