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,
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
end
test "it creates report note", %{admin_id: admin_id, report_id: report_id} do
+ [note, _] = Repo.all(Pleroma.ReportNote)
+
assert %{
activity_id: ^report_id,
content: "this is disgusting!",
user_id: ^admin_id
- } = Repo.one(Pleroma.ReportNote)
+ } = note
end
test "it returns reports with notes", %{admin: admin} do
assert note["user"]["nickname"] == admin.nickname
assert note["content"] == "this is disgusting!"
+ assert note["created_at"]
assert response["total"] == 1
end
end