Преглед на файлове

Federate attachments as Links instead of Documents

attachment-meta
Alex Gleason преди 3 години
родител
ревизия
6f0b42656d
No known key found for this signature in database GPG Key ID: 7211D1F99744FBB7
променени са 1 файла, в които са добавени 5 реда и са изтрити 3 реда
  1. +5
    -3
      lib/pleroma/web/activity_pub/transmogrifier.ex

+ 5
- 3
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)
|> 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],
@@ -963,7 +963,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
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,
@@ -971,6 +971,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
"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)


Loading…
Отказ
Запис