Get create activity from created object id.

This is useful for Ostatus federation because ostatus doesn't have
different ids for objects and activities...
This commit is contained in:
Roger Braun 2017-04-30 11:16:41 +02:00
commit 9d7c3190cc
3 changed files with 13 additions and 1 deletions

View file

@ -18,4 +18,9 @@ defmodule Pleroma.Activity do
Repo.all(from activity in Activity,
where: fragment("? @> ?", activity.data, ^%{object: %{id: ap_id}}))
end
def get_create_activity_by_object_ap_id(ap_id) do
Repo.one(from activity in Activity,
where: fragment("? @> ?", activity.data, ^%{type: "Create", object: %{id: ap_id}}))
end
end