forked from YokaiRick/akkoma
mastodon_api_controller.ex: fallback to first for min_id
This commit is contained in:
parent
6b407872b4
commit
c8abef373b
1 changed files with 10 additions and 1 deletions
|
@ -212,7 +212,16 @@ defp add_link_headers(conn, method, activities, param \\ nil, params \\ %{}) do
|
||||||
|> Map.get("limit", "20")
|
|> Map.get("limit", "20")
|
||||||
|> String.to_integer()
|
|> String.to_integer()
|
||||||
|
|
||||||
min_id = Enum.at(activities, limit * -1)
|
min_id =
|
||||||
|
if length(activities) <= limit do
|
||||||
|
activities
|
||||||
|
|> List.first()
|
||||||
|
|> Map.get(:id)
|
||||||
|
else
|
||||||
|
activities
|
||||||
|
|> Enum.at(limit * -1)
|
||||||
|
|> Map.get(:id)
|
||||||
|
end
|
||||||
|
|
||||||
{next_url, prev_url} =
|
{next_url, prev_url} =
|
||||||
if param do
|
if param do
|
||||||
|
|
Loading…
Reference in a new issue