diff options
Diffstat (limited to 'lib/pleroma/activity.ex')
-rw-r--r-- | lib/pleroma/activity.ex | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index d77c88997..40e14005b 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -12,16 +12,17 @@ defmodule Pleroma.Activity do def get_by_ap_id(ap_id) do Repo.one(from activity in Activity, - where: fragment("? @> ?", activity.data, ^%{id: ap_id})) + where: fragment("(?)->>'id' = ?", activity.data, ^to_string(ap_id))) end def all_by_object_ap_id(ap_id) do Repo.all(from activity in Activity, - where: fragment("? @> ?", activity.data, ^%{object: %{id: ap_id}})) + where: fragment("(?)->'object'->>'id' = ?", activity.data, ^to_string(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}})) + where: fragment("(?)->'object'->>'id' = ?", activity.data, ^to_string(ap_id)) + and fragment("(?)->>'type' = 'Create'", activity.data)) end end |