Store private announcements in object.data["announcements"], filter them on display

This commit is contained in:
Thibaut Girka 2019-10-01 21:40:35 +02:00
commit 427d0c2a00
3 changed files with 32 additions and 3 deletions

View file

@ -557,7 +557,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
|> post("/api/v1/statuses/#{activity.id}/reblog", %{"visibility" => "private"})
assert %{
"reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 0},
"reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1},
"reblogged" => true,
"visibility" => "private"
} = json_response(conn, 200)
@ -1167,6 +1167,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
assert Enum.empty?(response)
end
test "does not return users who have reblogged the status privately", %{
conn: %{assigns: %{user: user}} = conn,
activity: activity
} do
other_user = insert(:user)
{:ok, _, _} = CommonAPI.repeat(activity.id, other_user, %{"visibility" => "private"})
response =
conn
|> assign(:user, user)
|> get("/api/v1/statuses/#{activity.id}/reblogged_by")
|> json_response(:ok)
assert Enum.empty?(response)
end
test "does not fail on an unauthenticated request", %{conn: conn, activity: activity} do
other_user = insert(:user)
{:ok, _, _} = CommonAPI.repeat(activity.id, other_user)