Use more efficient query.
authorRoger Braun <roger@rogerbraun.net>
Tue, 20 Jun 2017 14:02:17 +0000 (16:02 +0200)
committerRoger Braun <roger@rogerbraun.net>
Tue, 20 Jun 2017 14:02:17 +0000 (16:02 +0200)
lib/pleroma/activity.ex

index d77c8899749a7dd16e568829e3a77340392afa31..f48199cae876b8441af760973b5868b1df7d7924 100644 (file)
@@ -12,7 +12,7 @@ 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