Переглянути джерело

TimelineController: Only return `Create` in public timelines.

1570-levenshtein-distance-user-search
lain 4 роки тому
джерело
коміт
d4d4b92f75
2 змінених файлів з 10 додано та 3 видалено
  1. +1
    -1
      lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex
  2. +9
    -2
      test/web/mastodon_api/controllers/timeline_controller_test.exs

+ 1
- 1
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)


+ 9
- 2
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


Завантаження…
Відмінити
Зберегти