projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
02b9436
)
Federate attachments as Links instead of Documents
author
Alex Gleason
<alex@alexgleason.me>
Thu, 13 May 2021 00:03:10 +0000
(19:03 -0500)
committer
Alex Gleason
<alex@alexgleason.me>
Thu, 13 May 2021 00:25:37 +0000
(19:25 -0500)
lib/pleroma/web/activity_pub/transmogrifier.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/web/activity_pub/transmogrifier.ex
b/lib/pleroma/web/activity_pub/transmogrifier.ex
index b5767863c6733a70dcb7fe8d067aa65989b34d43..acb4f4b3ead7232ab3a44c5e9c67acd423a8210a 100644
(file)
--- a/
lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/
lib/pleroma/web/activity_pub/transmogrifier.ex
@@
-245,8
+245,8
@@
defmodule Pleroma.Web.ActivityPub.Transmogrifier do
"type" => Map.get(url || %{}, "type", "Link")
}
|> Maps.put_if_present("mediaType", media_type)
"type" => Map.get(url || %{}, "type", "Link")
}
|> Maps.put_if_present("mediaType", media_type)
- |> Maps.put_if_present("width", (url || %{})["width"])
- |> Maps.put_if_present("height", (url || %{})["height"])
+ |> Maps.put_if_present("width", (url || %{})["width"]
|| data["width"]
)
+ |> Maps.put_if_present("height", (url || %{})["height"]
|| data["height"]
)
%{
"url" => [attachment_url],
%{
"url" => [attachment_url],
@@
-963,7
+963,7
@@
defmodule Pleroma.Web.ActivityPub.Transmogrifier do
object
|> Map.get("attachment", [])
|> Enum.map(fn data ->
object
|> Map.get("attachment", [])
|> Enum.map(fn data ->
- [%{"mediaType" => media_type, "href" => href} | _] = data["url"]
+ [%{"mediaType" => media_type, "href" => href}
= url
| _] = data["url"]
%{
"url" => href,
%{
"url" => href,
@@
-971,6
+971,8
@@
defmodule Pleroma.Web.ActivityPub.Transmogrifier do
"name" => data["name"],
"type" => "Document"
}
"name" => data["name"],
"type" => "Document"
}
+ |> Maps.put_if_present("width", url["width"])
+ |> Maps.put_if_present("height", url["height"])
end)
Map.put(object, "attachment", attachments)
end)
Map.put(object, "attachment", attachments)