Fix pagination

This commit is contained in:
Egor Kislitsyn 2020-06-05 23:18:29 +04:00
parent b02df1803e
commit 167812a3f2
No known key found for this signature in database
GPG Key ID: 1B49CB15B71E7805
2 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,9 @@ defmodule Pleroma.Pagination do
@default_limit 20 @default_limit 20
@max_limit 40 @max_limit 40
@page_keys ["max_id", "min_id", "limit", "since_id", "order"]
def page_keys, do: @page_keys
@spec fetch_paginated(Ecto.Query.t(), map(), type(), atom() | nil) :: [Ecto.Schema.t()] @spec fetch_paginated(Ecto.Query.t(), map(), type(), atom() | nil) :: [Ecto.Schema.t()]
def fetch_paginated(query, params, type \\ :keyset, table_binding \\ nil) def fetch_paginated(query, params, type \\ :keyset, table_binding \\ nil)

View File

@ -238,6 +238,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
params params
|> Map.drop(["nickname", "page"]) |> Map.drop(["nickname", "page"])
|> Map.put("include_poll_votes", true) |> Map.put("include_poll_votes", true)
|> Map.new(fn {k, v} -> {String.to_existing_atom(k), v} end)
activities = ActivityPub.fetch_user_activities(user, for_user, params) activities = ActivityPub.fetch_user_activities(user, for_user, params)
@ -354,6 +355,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|> Map.drop(["nickname", "page"]) |> Map.drop(["nickname", "page"])
|> Map.put("blocking_user", user) |> Map.put("blocking_user", user)
|> Map.put("user", user) |> Map.put("user", user)
|> Map.new(fn {k, v} -> {String.to_existing_atom(k), v} end)
activities = activities =
[user.ap_id | User.following(user)] [user.ap_id | User.following(user)]