From: Haelwenn (lanodan) Monnier Date: Thu, 28 Mar 2019 16:18:44 +0000 (+0100) Subject: mastodon_api_controller.ex: fallback to first for min_id X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=c8abef373b32313f94fc34b33dc235ca6aabceed;p=akkoma mastodon_api_controller.ex: fallback to first for min_id --- diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index 5cc19e68f..b2fc68707 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -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