transmogrifier: When it’s a Video move "url" to "attachment"
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Sat, 17 Nov 2018 17:34:45 +0000 (18:34 +0100)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sun, 23 Dec 2018 13:00:25 +0000 (13:00 +0000)
lib/pleroma/web/activity_pub/transmogrifier.ex

index e6af4b211a5cc81018b066110eb90ece0f5ec3e4..d5cc829188fbe3a522036fce3192418628b08b1d 100644 (file)
@@ -69,8 +69,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   def fix_object(object) do
     object
     |> fix_actor
-    |> fix_attachments
     |> fix_url
+    |> fix_attachments
     |> fix_context
     |> fix_in_reply_to
     |> fix_emoji
@@ -200,8 +200,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
         true -> ""
       end
 
-    object
-    |> Map.put("url", url_string)
+    if Map.get(object, "type") == "Video" do
+      object
+      |> Map.delete("url")
+      |> Map.put("attachment", url_string)
+    else
+      object
+      |> Map.put("url", url_string)
+    end
   end
 
   def fix_url(object), do: object