Exclude private and direct statuses visible to the admin when using godmode
This commit is contained in:
parent
927079e2ff
commit
ad22e94f33
|
@ -745,14 +745,14 @@ def report_notes_delete(%{assigns: %{user: user}} = conn, %{
|
|||
end
|
||||
end
|
||||
|
||||
def list_statuses(%{assigns: %{user: admin}} = conn, params) do
|
||||
def list_statuses(%{assigns: %{user: _admin}} = conn, params) do
|
||||
godmode = params["godmode"] == "true" || params["godmode"] == true
|
||||
local_only = params["local_only"] == "true" || params["local_only"] == true
|
||||
with_reblogs = params["with_reblogs"] == "true" || params["with_reblogs"] == true
|
||||
{page, page_size} = page_params(params)
|
||||
|
||||
activities =
|
||||
ActivityPub.fetch_statuses(admin, %{
|
||||
ActivityPub.fetch_statuses(nil, %{
|
||||
"godmode" => godmode,
|
||||
"local_only" => local_only,
|
||||
"limit" => page_size,
|
||||
|
|
|
@ -3066,7 +3066,7 @@ test "pleroma restarts", %{conn: conn} do
|
|||
end
|
||||
|
||||
describe "GET /api/pleroma/admin/statuses" do
|
||||
test "returns all public, unlisted, and direct statuses", %{conn: conn, admin: admin} do
|
||||
test "returns all public and unlisted statuses", %{conn: conn, admin: admin} do
|
||||
blocked = insert(:user)
|
||||
user = insert(:user)
|
||||
User.block(admin, blocked)
|
||||
|
@ -3085,7 +3085,7 @@ test "returns all public, unlisted, and direct statuses", %{conn: conn, admin: a
|
|||
|> json_response(200)
|
||||
|
||||
refute "private" in Enum.map(response, & &1["visibility"])
|
||||
assert length(response) == 4
|
||||
assert length(response) == 3
|
||||
end
|
||||
|
||||
test "returns only local statuses with local_only on", %{conn: conn} do
|
||||
|
@ -3102,12 +3102,16 @@ test "returns only local statuses with local_only on", %{conn: conn} do
|
|||
assert length(response) == 1
|
||||
end
|
||||
|
||||
test "returns private statuses with godmode on", %{conn: conn} do
|
||||
test "returns private and direct statuses with godmode on", %{conn: conn, admin: admin} do
|
||||
user = insert(:user)
|
||||
|
||||
{:ok, _} =
|
||||
CommonAPI.post(user, %{"status" => "@#{admin.nickname}", "visibility" => "direct"})
|
||||
|
||||
{:ok, _} = CommonAPI.post(user, %{"status" => ".", "visibility" => "private"})
|
||||
{:ok, _} = CommonAPI.post(user, %{"status" => ".", "visibility" => "public"})
|
||||
conn = get(conn, "/api/pleroma/admin/statuses?godmode=true")
|
||||
assert json_response(conn, 200) |> length() == 2
|
||||
assert json_response(conn, 200) |> length() == 3
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue