transmogrifier: Just make attachement maps into a list and reroll
[akkoma] / lib / pleroma / web / activity_pub / transmogrifier.ex
index 611c0e623bb976bc26a0be0c4cb41422ffa65a55..76998c802014942f7d2bcef4420ac62af3e845c0 100644 (file)
@@ -126,12 +126,12 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
           |> Map.put("context", replied_object.data["context"] || object["conversation"])
         else
           e ->
-            Logger.error("Couldn't fetch #{object["inReplyTo"]} #{inspect(e)}")
+            Logger.error("Couldn't fetch \"#{inspect(in_reply_to_id)}\", error: #{inspect(e)}")
             object
         end
 
       e ->
-        Logger.error("Couldn't fetch #{object["inReplyTo"]} #{inspect(e)}")
+        Logger.error("Couldn't fetch \"#{inspect(in_reply_to_id)}\", error: #{inspect(e)}")
         object
     end
   end
@@ -159,12 +159,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   end
 
   def fix_attachments(%{"attachment" => attachment} = object) when is_map(attachment) do
-    attachment =
-      Map.put(attachment, "url", [
-        %{"type" => "Link", "mediaType" => attachment["mediaType"], "href" => attachment["url"]}
-      ])
-
-    Map.put(object, "attachment", attachment)
+    Map.put(object, "attachment", [attachment])
+    |> fix_attachments()
   end
 
   def fix_attachments(object), do: object