transmogrifier: reformat `cond` block by hand

This commit is contained in:
William Pitcock 2018-09-26 18:47:18 +00:00 committed by Haelwenn (lanodan) Monnier
parent eebe33e86a
commit ed8dfa3029
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
1 changed files with 11 additions and 4 deletions

View File

@ -100,11 +100,18 @@ 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 =
cond do cond do
is_bitstring(in_reply_to) -> in_reply_to is_bitstring(in_reply_to) ->
is_map(in_reply_to) && is_bitstring(in_reply_to["id"]) -> in_reply_to["id"] in_reply_to
is_list(in_reply_to) && is_bitstring(Enum.at(in_reply_to, 0)) -> Enum.at(in_reply_to, 0)
is_map(in_reply_to) && is_bitstring(in_reply_to["id"]) ->
in_reply_to["id"]
is_list(in_reply_to) && is_bitstring(Enum.at(in_reply_to, 0)) ->
Enum.at(in_reply_to, 0)
# Maybe I should output an error too? # Maybe I should output an error too?
true -> "" 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