From 0ff1985304617142a813d5c546a4896f824a0c41 Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 8 Oct 2019 12:21:45 +0200 Subject: [PATCH] Object: Use ap_id column. --- lib/pleroma/activity.ex | 4 ++-- lib/pleroma/object.ex | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index c1065611b..9a00598dc 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -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 ), diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 0b8532832..96d4ea765 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -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