Stop depending on the embedded object in restrict_favorited_by
authorrinpatch <rinpatch@sdf.org>
Tue, 6 Aug 2019 21:12:42 +0000 (00:12 +0300)
committerrinpatch <rinpatch@sdf.org>
Tue, 6 Aug 2019 21:12:42 +0000 (00:12 +0300)
lib/pleroma/web/activity_pub/activity_pub.ex

index 2877c029e0c61f9c6e2889cbebc6543f5e16fe3f..1a279a7df1b7f00e06c6ef3120d8f77585221f2d 100644 (file)
@@ -749,8 +749,8 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
 
   defp restrict_favorited_by(query, %{"favorited_by" => ap_id}) do
     from(
-      activity in query,
-      where: fragment(~s(? <@ (? #> '{"object","likes"}'\)), ^ap_id, activity.data)
+      [_activity, object] in query,
+      where: fragment("(?)->'likes' \\? (?)", object.data, ^ap_id)
     )
   end