diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2019-03-28 17:18:44 +0100 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2019-03-28 17:23:21 +0100 |
commit | c8abef373b32313f94fc34b33dc235ca6aabceed (patch) | |
tree | 3df278432e5498422e39cf92459dfc631998a1a6 /lib | |
parent | 6b407872b402b72dba48bece5fa69ca5af54f2f0 (diff) | |
download | pleroma-c8abef373b32313f94fc34b33dc235ca6aabceed.tar.gz |
mastodon_api_controller.ex: fallback to first for min_id
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 11 |
1 files changed, 10 insertions, 1 deletions
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 |