object: normalize(): use object cache
authorWilliam Pitcock <nenolod@dereferenced.org>
Sun, 25 Nov 2018 21:20:29 +0000 (21:20 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Tue, 4 Dec 2018 04:52:09 +0000 (04:52 +0000)
lib/pleroma/object.ex

index 03a75dfbdbbcdcf00bbf9493b1c8cc9272868266..57a8b1d6b08f3664149314ab40c95ba67fd86151 100644 (file)
@@ -27,8 +27,8 @@ defmodule Pleroma.Object do
     Repo.one(from(object in Object, where: fragment("(?)->>'id' = ?", object.data, ^ap_id)))
   end
 
-  def normalize(obj) when is_map(obj), do: Object.get_by_ap_id(obj["id"])
-  def normalize(ap_id) when is_binary(ap_id), do: Object.get_by_ap_id(ap_id)
+  def normalize(obj) when is_map(obj), do: normalize(obj["id"])
+  def normalize(ap_id) when is_binary(ap_id), do: get_cached_by_ap_id(ap_id)
   def normalize(_), do: nil
 
   if Mix.env() == :test do