From: William Pitcock Date: Thu, 22 Mar 2018 04:47:18 +0000 (+0000) Subject: activitypub: add restrict_limit X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=381ba256bf9341eb70d03988bf3a31c3fcd7b9a5;p=akkoma activitypub: add restrict_limit --- 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub 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 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do |> restrict_tag(opts) |> restrict_since(opts) |> restrict_local(opts) + |> restrict_limit(opts) |> restrict_max(opts) |> restrict_actor(opts) |> restrict_type(opts)