projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
little cleanup
[akkoma]
/
lib
/
pleroma
/
pagination.ex
diff --git
a/lib/pleroma/pagination.ex
b/lib/pleroma/pagination.ex
index 243f1a3295c37b48bae595388734cc6090f84e89..4535ca7c5c2b65d3d68b9acf469996ccfec8da51 100644
(file)
--- a/
lib/pleroma/pagination.ex
+++ b/
lib/pleroma/pagination.ex
@@
-38,7
+38,10
@@
defmodule Pleroma.Pagination do
end
def fetch_paginated(query, %{"total" => true} = params, :offset, table_binding) do
end
def fetch_paginated(query, %{"total" => true} = params, :offset, table_binding) do
- total = Repo.aggregate(query, :count, :id)
+ total =
+ query
+ |> Ecto.Query.exclude(:left_join)
+ |> Repo.aggregate(:count, :id)
%{
total: total,
%{
total: total,
@@
-78,7
+81,8
@@
defmodule Pleroma.Pagination do
since_id: :string,
max_id: :string,
offset: :integer,
since_id: :string,
max_id: :string,
offset: :integer,
- limit: :integer
+ limit: :integer,
+ skip_order: :boolean
}
params =
}
params =
@@
-103,6
+107,8
@@
defmodule Pleroma.Pagination do
where(query, [{q, table_position(query, table_binding)}], q.id < ^max_id)
end
where(query, [{q, table_position(query, table_binding)}], q.id < ^max_id)
end
+ defp restrict(query, :order, %{skip_order: true}, _), do: query
+
defp restrict(query, :order, %{min_id: _}, table_binding) do
order_by(
query,
defp restrict(query, :order, %{min_id: _}, table_binding) do
order_by(
query,