From 9da4c88b49b4ccdc1eac90e04e9d8948fd943f37 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Mon, 18 Nov 2019 10:00:48 +0300 Subject: [PATCH] fix test --- lib/pleroma/pagination.ex | 3 +++ .../web/mastodon_api/controllers/status_controller.ex | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/pagination.ex b/lib/pleroma/pagination.ex index 9d279fba7..c77ba78bb 100644 --- a/lib/pleroma/pagination.ex +++ b/lib/pleroma/pagination.ex @@ -13,6 +13,9 @@ defmodule Pleroma.Pagination do alias Pleroma.Repo @default_limit 20 + @page_keys ["max_id", "min_id", "limit", "since_id", "order"] + + def page_keys, do: @page_keys def fetch_paginated(query, params, type \\ :keyset) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index cdc4cec9c..e11bee383 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -346,7 +346,12 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do @doc "GET /api/v1/favourites" def favourites(%{assigns: %{user: user}} = conn, params) do - activities = ActivityPub.fetch_favourites([], user, Map.take(params, ["limit"])) + activities = + ActivityPub.fetch_favourites( + [], + user, + Map.take(params, Pleroma.Pagination.page_keys()) + ) conn |> add_link_headers(activities) -- 2.45.2