This commit is contained in:
Maksim Pechnikov 2019-11-18 10:00:48 +03:00
parent 4beb3ce5c5
commit 9da4c88b49
2 changed files with 9 additions and 1 deletions

View file

@ -13,6 +13,9 @@ defmodule Pleroma.Pagination do
alias Pleroma.Repo alias Pleroma.Repo
@default_limit 20 @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) def fetch_paginated(query, params, type \\ :keyset)

View file

@ -346,7 +346,12 @@ def context(%{assigns: %{user: user}} = conn, %{"id" => id}) do
@doc "GET /api/v1/favourites" @doc "GET /api/v1/favourites"
def favourites(%{assigns: %{user: user}} = conn, params) do 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 conn
|> add_link_headers(activities) |> add_link_headers(activities)