Exclude reblogs from `GET /api/pleroma/admin/statuses` by default
authoreugenijm <eugenijm@protonmail.com>
Mon, 2 Mar 2020 13:47:30 +0000 (16:47 +0300)
committereugenijm <eugenijm@protonmail.com>
Mon, 2 Mar 2020 13:47:31 +0000 (16:47 +0300)
docs/API/admin_api.md
lib/pleroma/web/admin_api/admin_api_controller.ex

index 91c76ce004f0edad199132e950e72101dfba3dd1..47afdfba5a576d6678c677194a6a34b7b268b44d 100644 (file)
@@ -278,6 +278,19 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret
   - On failure: `Not found`
   - On success: JSON array of instance's latest statuses
 
+## `GET /api/pleroma/admin/statuses`
+
+### Retrives all latest statuses
+
+- Params:
+  - *optional* `page_size`: number of statuses to return (default is `20`)
+  - *optional* `local_only`: excludes remote statuses
+  - *optional* `godmode`: `true`/`false` – allows to see private statuses
+  - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false)
+- Response:
+  - On failure: `Not found`
+  - On success: JSON array of user's latest statuses
+
 ## `POST /api/pleroma/admin/relay`
 
 ### Follow a Relay
index 558832703ac93fc0d3c4573b144de01b5c80e464..de0755ee55374cf3fd920523b8e1e2d7260df938 100644 (file)
@@ -748,6 +748,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController 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 =
@@ -755,7 +756,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
         "godmode" => godmode,
         "local_only" => local_only,
         "limit" => page_size,
-        "offset" => (page - 1) * page_size
+        "offset" => (page - 1) * page_size,
+        "exclude_reblogs" => !with_reblogs && "true"
       })
 
     conn