From 381ba256bf9341eb70d03988bf3a31c3fcd7b9a5 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 22 Mar 2018 04:47:18 +0000 Subject: [PATCH] activitypub: add restrict_limit --- lib/pleroma/web/activity_pub/activity_pub.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 7b1207ce2..bdc1b5df7 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -185,6 +185,12 @@ defp restrict_recipients(query, recipients, user) do or_where: activity.actor == ^user.ap_id end + defp restrict_limit(query, %{"limit" => limit}) do + from activity in query, + limit: ^limit + end + defp restrict_limit(query, _), do: query + defp restrict_local(query, %{"local_only" => true}) do from activity in query, where: activity.local == true end @@ -248,6 +254,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> restrict_tag(opts) |> restrict_since(opts) |> restrict_local(opts) + |> restrict_limit(opts) |> restrict_max(opts) |> restrict_actor(opts) |> restrict_type(opts)