mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 16:40:29 +00:00
Return nil for nil object requests.
This commit is contained in:
parent
b35ff8f755
commit
261ec82451
1 changed files with 1 additions and 0 deletions
|
@ -21,6 +21,7 @@ defmodule Pleroma.Object do
|
||||||
|> unique_constraint(:ap_id, name: :objects_unique_apid_index)
|
|> unique_constraint(:ap_id, name: :objects_unique_apid_index)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_by_ap_id(nil), do: nil
|
||||||
def get_by_ap_id(ap_id) do
|
def get_by_ap_id(ap_id) do
|
||||||
Repo.one(from object in Object,
|
Repo.one(from object in Object,
|
||||||
where: fragment("? @> ?", object.data, ^%{id: ap_id}))
|
where: fragment("? @> ?", object.data, ^%{id: ap_id}))
|
||||||
|
|
Loading…
Reference in a new issue