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,
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)
|> 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
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