projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
95cedd6
)
Add type restriction to activitypub fetcher
author
Roger Braun
<roger@rogerbraun.net>
Sat, 9 Sep 2017 10:05:17 +0000
(12:05 +0200)
committer
Roger Braun
<roger@rogerbraun.net>
Sat, 9 Sep 2017 10:05:17 +0000
(12:05 +0200)
Mainly because Mastodon only returns notes, not the other activities.
lib/pleroma/web/activity_pub/activity_pub.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/web/activity_pub/activity_pub.ex
b/lib/pleroma/web/activity_pub/activity_pub.ex
index db1302738d7276176d297fcae3a9154df5ea9c99..8ae32165824511f97e8c13ccf25572541689ef7b 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub.ex
@@
-133,6
+133,12
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
defp restrict_actor(query, _), do: query
+ defp restrict_type(query, %{"type" => type}) do
+ from activity in query,
+ where: fragment("?->>'type' = ?", activity.data, ^type)
+ end
+ defp restrict_type(query, _), do: query
+
def fetch_activities(recipients, opts \\ %{}) do
base_query = from activity in Activity,
limit: 20,
@@
-144,6
+150,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
|> restrict_local(opts)
|> restrict_max(opts)
|> restrict_actor(opts)
+ |> restrict_type(opts)
|> Repo.all
|> Enum.reverse
end