mastodon_api_controller.ex: fallback to first for min_id

This commit is contained in:
Haelwenn (lanodan) Monnier 2019-03-28 17:18:44 +01:00
parent 6b407872b4
commit c8abef373b
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -212,7 +212,16 @@ defp add_link_headers(conn, method, activities, param \\ nil, params \\ %{}) do
|> Map.get("limit", "20")
|> 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} =
if param do