Revert "Longer timeouts for user fetching."
[akkoma] / lib / pleroma / object.ex
index 72991fa1f028a3610867edc5cd5f8eec6d79c54d..a5a1d6a763a94302bb163fdf90de0b2802387fcb 100644 (file)
@@ -21,9 +21,10 @@ defmodule Pleroma.Object do
     |> unique_constraint(:ap_id, name: :objects_unique_apid_index)
   end
 
+  def get_by_ap_id(nil), do: nil
   def get_by_ap_id(ap_id) do
     Repo.one(from object in Object,
-      where: fragment("? @> ?", object.data, ^%{id: ap_id}))
+      where: fragment("(?)->>'id' = ?", object.data, ^ap_id))
   end
 
   def get_cached_by_ap_id(ap_id) do
@@ -43,6 +44,6 @@ defmodule Pleroma.Object do
   end
 
   def context_mapping(context) do
-    %Object{data: %{"id" => context}}
+    Object.change(%Object{}, %{data: %{"id" => context}})
   end
 end