From: Egor Kislitsyn Date: Fri, 5 Jun 2020 19:18:29 +0000 (+0400) Subject: Fix pagination X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=167812a3f2c1470012cb161f3c5ba4c021fbad97;p=akkoma Fix pagination --- diff --git a/lib/pleroma/pagination.ex b/lib/pleroma/pagination.ex index 0ccc7b1f2..1b99e44f9 100644 --- a/lib/pleroma/pagination.ex +++ b/lib/pleroma/pagination.ex @@ -16,6 +16,9 @@ defmodule Pleroma.Pagination do @default_limit 20 @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()] def fetch_paginated(query, params, type \\ :keyset, table_binding \\ nil) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 5b8441384..f0b5c6e93 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -238,6 +238,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do params |> Map.drop(["nickname", "page"]) |> 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) @@ -354,6 +355,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do |> Map.drop(["nickname", "page"]) |> Map.put("blocking_user", user) |> Map.put("user", user) + |> Map.new(fn {k, v} -> {String.to_existing_atom(k), v} end) activities = [user.ap_id | User.following(user)]