activitypub: transmogrifier: correctly handle nil inReplyTo value

This commit is contained in:
William Pitcock 2019-02-14 00:34:20 +00:00
parent 94cbbb0e3a
commit e05bf2940f

View file

@ -649,7 +649,7 @@ def get_obj_helper(id) do
if object = Object.normalize(id), do: {:ok, object}, else: nil
end
def set_reply_to_uri(%{"inReplyTo" => inReplyTo} = object) do
def set_reply_to_uri(%{"inReplyTo" => inReplyTo} = object) when is_binary(inReplyTo) do
with false <- String.starts_with?(inReplyTo, "http"),
{:ok, %{data: replied_to_object}} <- get_obj_helper(inReplyTo) do
Map.put(object, "inReplyTo", replied_to_object["external_url"] || inReplyTo)