transmogrifier: Just make attachement maps into a list and reroll
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 27 Sep 2018 09:38:30 +0000 (11:38 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Thu, 27 Sep 2018 18:00:48 +0000 (20:00 +0200)
lib/pleroma/web/activity_pub/transmogrifier.ex

index 7bdb9594a0c390a3dc3e1515b03c981a6c8356d3..76998c802014942f7d2bcef4420ac62af3e845c0 100644 (file)
@@ -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