1 defmodule Pleroma.Object do
3 alias Pleroma.{Repo, Object}
12 def get_by_ap_id(ap_id) do
13 Repo.one(from object in Object,
14 where: fragment("? @> ?", object.data, ^%{id: ap_id}))
17 def get_cached_by_ap_id(ap_id) do
18 if Mix.env == :test do
21 key = "object:#{ap_id}"
22 Cachex.get!(:user_cache, key, fallback: fn(_) ->
23 object = get_by_ap_id(ap_id)
33 def context_mapping(context) do
34 %Object{data: %{"id" => context}}