|
|
@@ -14,6 +14,15 @@ defmodule Pleroma.Object do |
|
|
|
where: fragment("? @> ?", object.data, ^%{id: ap_id})) |
|
|
|
end |
|
|
|
|
|
|
|
def get_cached_by_ap_id(ap_id) do |
|
|
|
if Mix.env == :test do |
|
|
|
get_by_ap_id(ap_id) |
|
|
|
else |
|
|
|
key = "object:#{ap_id}" |
|
|
|
Cachex.get!(:user_cache, key, fallback: fn(_) -> get_by_ap_id(ap_id) end) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def context_mapping(context) do |
|
|
|
%Object{data: %{"id" => context}} |
|
|
|
end |
|
|
|