projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7e384a2
)
object: use cached accesses when possible in Object.normalize()
author
William Pitcock
<nenolod@dereferenced.org>
Fri, 1 Feb 2019 19:38:57 +0000
(19:38 +0000)
committer
William Pitcock
<nenolod@dereferenced.org>
Fri, 1 Feb 2019 19:38:57 +0000
(19:38 +0000)
lib/pleroma/object.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/object.ex
b/lib/pleroma/object.ex
index 707a61f14c44d02d3b4cf769c5b4ab41d14aebb2..1088bb5e4f5f20116424f2b84bd961478fb50c7d 100644
(file)
--- 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