added total
to the instance adminAPI endpoint
This commit is contained in:
parent
6806c03e85
commit
d4158e8bf0
5 changed files with 45 additions and 25 deletions
|
|
@ -632,7 +632,18 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
|> fetch_activities(params, pagination_type)
|
||||
end
|
||||
|
||||
def fetch_statuses(reading_user, %{total: true} = params) do
|
||||
result = fetch_activities_for_reading_user(reading_user, params)
|
||||
Keyword.put(result, :items, Enum.reverse(result[:items]))
|
||||
end
|
||||
|
||||
def fetch_statuses(reading_user, params) do
|
||||
reading_user
|
||||
|> fetch_activities_for_reading_user(params)
|
||||
|> Enum.reverse()
|
||||
end
|
||||
|
||||
defp fetch_activities_for_reading_user(reading_user, params) do
|
||||
params = Map.put(params, :type, ["Create", "Announce"])
|
||||
|
||||
%{
|
||||
|
|
@ -641,7 +652,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
}
|
||||
|> user_activities_recipients()
|
||||
|> fetch_activities(params, :offset)
|
||||
|> Enum.reverse()
|
||||
end
|
||||
|
||||
defp user_activities_recipients(%{godmode: true}), do: []
|
||||
|
|
|
|||
|
|
@ -85,17 +85,18 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
|
|||
with_reblogs = params["with_reblogs"] == "true" || params["with_reblogs"] == true
|
||||
{page, page_size} = page_params(params)
|
||||
|
||||
activities =
|
||||
result =
|
||||
ActivityPub.fetch_statuses(nil, %{
|
||||
instance: instance,
|
||||
limit: page_size,
|
||||
offset: (page - 1) * page_size,
|
||||
exclude_reblogs: not with_reblogs
|
||||
exclude_reblogs: not with_reblogs,
|
||||
total: true
|
||||
})
|
||||
|
||||
conn
|
||||
|> put_view(AdminAPI.StatusView)
|
||||
|> render("index.json", %{activities: activities, as: :activity})
|
||||
|> render("index.json", %{total: result[:total], activities: result[:items], as: :activity})
|
||||
end
|
||||
|
||||
def list_user_statuses(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname} = params) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue