forked from AkkomaGang/akkoma
activitypub: add restrict_limit
This commit is contained in:
parent
1a94704230
commit
381ba256bf
1 changed files with 7 additions and 0 deletions
|
@ -185,6 +185,12 @@ defp restrict_recipients(query, recipients, user) do
|
||||||
or_where: activity.actor == ^user.ap_id
|
or_where: activity.actor == ^user.ap_id
|
||||||
end
|
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
|
defp restrict_local(query, %{"local_only" => true}) do
|
||||||
from activity in query, where: activity.local == true
|
from activity in query, where: activity.local == true
|
||||||
end
|
end
|
||||||
|
@ -248,6 +254,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do
|
||||||
|> restrict_tag(opts)
|
|> restrict_tag(opts)
|
||||||
|> restrict_since(opts)
|
|> restrict_since(opts)
|
||||||
|> restrict_local(opts)
|
|> restrict_local(opts)
|
||||||
|
|> restrict_limit(opts)
|
||||||
|> restrict_max(opts)
|
|> restrict_max(opts)
|
||||||
|> restrict_actor(opts)
|
|> restrict_actor(opts)
|
||||||
|> restrict_type(opts)
|
|> restrict_type(opts)
|
||||||
|
|
Loading…
Reference in a new issue