Object: Use ap_id column.

This commit is contained in:
lain 2019-10-08 12:21:45 +02:00
parent 8785ad8d90
commit 0ff1985304
2 changed files with 3 additions and 3 deletions

View File

@ -70,8 +70,8 @@ defmodule Pleroma.Activity do
join(query, join_type, [activity], o in Object,
on:
fragment(
"(?->>'id') = COALESCE(?->'object'->>'id', ?->>'object')",
o.data,
"? = COALESCE(?->'object'->>'id', ?->>'object')",
o.ap_id,
activity.data,
activity.data
),

View File

@ -67,7 +67,7 @@ defmodule Pleroma.Object do
def get_by_ap_id(nil), do: nil
def get_by_ap_id(ap_id) do
Repo.one(from(object in Object, where: fragment("(?)->>'id' = ?", object.data, ^ap_id)))
Repo.one(from(object in Object, where: object.ap_id == ^ap_id))
end
defp warn_on_no_object_preloaded(ap_id) do