diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-03-22 04:47:18 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-03-22 00:26:47 -0500 |
commit | 381ba256bf9341eb70d03988bf3a31c3fcd7b9a5 (patch) | |
tree | 3b50931d64e8cb51b2c7e5b3131dd3df35171474 /lib | |
parent | 1a947042300045cadc62ea1153a75129f5282281 (diff) | |
download | pleroma-381ba256bf9341eb70d03988bf3a31c3fcd7b9a5.tar.gz |
activitypub: add restrict_limit
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub.ex | 7 |
1 files changed, 7 insertions, 0 deletions
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) |