2017-03-21 08:21:52 +00:00
|
|
|
defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|
|
|
alias Pleroma.Repo
|
|
|
|
alias Pleroma.Activity
|
2017-03-21 16:53:20 +00:00
|
|
|
import Ecto.Query
|
2017-03-21 08:21:52 +00:00
|
|
|
|
|
|
|
def insert(map) when is_map(map) do
|
|
|
|
Repo.insert(%Activity{data: map})
|
|
|
|
end
|
2017-03-21 16:53:20 +00:00
|
|
|
|
|
|
|
def fetch_public_activities do
|
|
|
|
query = from activity in Activity,
|
|
|
|
where: fragment(~s(? @> '{"to": ["https://www.w3.org/ns/activitystreams#Public"]}'), activity.data)
|
|
|
|
|
|
|
|
Repo.all(query)
|
|
|
|
end
|
2017-03-21 08:21:52 +00:00
|
|
|
end
|