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 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController 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