diff options
author | William Pitcock <nenolod@dereferenced.org> | 2019-02-01 19:38:57 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2019-02-01 19:38:57 +0000 |
commit | af10ef8d4e4aefc7760bd85a4723c79a0bfbf2e0 (patch) | |
tree | 77180217afaebbb463379a8079342e337026eba4 /lib | |
parent | 7e384a2425b5188ca76aad4b97172b553ca9b640 (diff) | |
download | pleroma-af10ef8d4e4aefc7760bd85a4723c79a0bfbf2e0.tar.gz |
object: use cached accesses when possible in Object.normalize()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/object.ex | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 707a61f14..1088bb5e4 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -31,8 +31,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(%{"id" => ap_id}), do: normalize(ap_id) + def normalize(ap_id) when is_binary(ap_id), do: get_cached_by_ap_id(ap_id) def normalize(_), do: nil # Owned objects can only be mutated by their owner |