0317b4cd5000e2d1db826901255c5def340a77c3
[akkoma] / lib / pleroma / web / activity_pub / activity_pub.ex
1 defmodule Pleroma.Web.ActivityPub.ActivityPub do
2 alias Pleroma.Repo
3 alias Pleroma.Activity
4 import Ecto.Query
5
6 def insert(map) when is_map(map) do
7 Repo.insert(%Activity{data: map})
8 end
9
10 def fetch_public_activities do
11 query = from activity in Activity,
12 where: fragment(~s(? @> '{"to": ["https://www.w3.org/ns/activitystreams#Public"]}'), activity.data)
13
14 Repo.all(query)
15 end
16 end