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
1 changed files with 10 additions and 1 deletions

View File

@ -212,7 +212,16 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController 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