TimelineController: Only return `Create` in public timelines.
authorlain <lain@soykaf.club>
Mon, 1 Jun 2020 11:17:56 +0000 (13:17 +0200)
committerlain <lain@soykaf.club>
Mon, 1 Jun 2020 11:17:56 +0000 (13:17 +0200)
lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex
test/web/mastodon_api/controllers/timeline_controller_test.exs

index 958567510bcc22d26e24c9c8bc456d6e28463476..f67f754304f9eea8ae8d9b2e9375d1c7cc2e209d 100644 (file)
@@ -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)
index 2375ac8e8d88ec23d6df9d2ba153109d54b3f8c5..65b4079fee0ecd1dd52a67eb37aff1535550e0d5 100644 (file)
@@ -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