Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into rum-index
[akkoma] / lib / pleroma / web / common_api / utils.ex
index 1dfe50b408266efd29f341ac37f5dc3b7b652d53..bee2fd159a2beec8bdebea14dec19562f962ab1d 100644 (file)
@@ -237,13 +237,11 @@ defmodule Pleroma.Web.CommonAPI.Utils do
       "tag" => tags |> Enum.map(fn {_, tag} -> tag end) |> Enum.uniq()
     }
 
-    if in_reply_to do
-      in_reply_to_object = Object.normalize(in_reply_to)
-
-      object
-      |> Map.put("inReplyTo", in_reply_to_object.data["id"])
+    with false <- is_nil(in_reply_to),
+         %Object{} = in_reply_to_object <- Object.normalize(in_reply_to) do
+      Map.put(object, "inReplyTo", in_reply_to_object.data["id"])
     else
-      object
+      _ -> object
     end
   end