transmogrifier: Use a cond, add proactive support for arrays
This commit is contained in:
parent
0aac72f1d3
commit
22927f3a34
@ -99,12 +99,12 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||||||
def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object)
|
def fix_in_reply_to(%{"inReplyTo" => in_reply_to} = object)
|
||||||
when not is_nil(in_reply_to) do
|
when not is_nil(in_reply_to) do
|
||||||
in_reply_to_id =
|
in_reply_to_id =
|
||||||
if is_bitstring(in_reply_to) do
|
cond do
|
||||||
in_reply_to
|
is_bitstring(in_reply_to) -> in_reply_to
|
||||||
else
|
is_map(in_reply_to) && is_bitstring(in_reply_to["id"]) -> in_reply_to["id"]
|
||||||
if is_map(in_reply_to) && in_reply_to["id"] do
|
is_list(in_reply_to) && is_bitstring(Enum.at(in_reply_to, 0)) -> Enum.at(in_reply_to, 0)
|
||||||
in_reply_to["id"]
|
# Maybe I should output an error too?
|
||||||
end
|
true -> ""
|
||||||
end
|
end
|
||||||
|
|
||||||
case ActivityPub.fetch_object_from_id(in_reply_to_id) do
|
case ActivityPub.fetch_object_from_id(in_reply_to_id) do
|
||||||
|
Loading…
Reference in New Issue
Block a user