Fix incorrect report count

This commit is contained in:
Maxim Filippov 2019-12-06 17:17:24 +09:00
commit 08c89fd2b8
3 changed files with 11 additions and 4 deletions

View file

@ -35,7 +35,10 @@ defmodule Pleroma.Pagination do
end
def fetch_paginated(query, %{"total" => true} = params, :offset) do
total = Repo.aggregate(query, :count, :id)
total =
query
|> Ecto.Query.exclude(:left_join)
|> Repo.aggregate(:count, :id)
%{
total: total,

View file

@ -69,12 +69,13 @@ defmodule Pleroma.Web.AdminAPI.ReportView do
def render("index_notes.json", _), do: []
def render("show_note.json", %{content: content, user_id: user_id}) do
def render("show_note.json", %{content: content, user_id: user_id, inserted_at: inserted_at}) do
user = User.get_by_id(user_id)
%{
content: content,
user: merge_account_views(user)
user: merge_account_views(user),
created_at: inserted_at
}
end