1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-18 02:49:18 +00:00

twitter api: provide object descriptions as attachment description field

This commit is contained in:
William Pitcock 2018-08-25 00:03:25 +00:00
parent be7a6db1f5
commit aab2bdddf4
2 changed files with 8 additions and 4 deletions

View file

@ -9,7 +9,8 @@ def to_map(%Object{data: %{"url" => [url | _]}} = object, _opts) do
url: url["href"] |> Pleroma.Web.MediaProxy.url(),
mimetype: url["mediaType"] || url["mimeType"],
id: data["uuid"],
oembed: false
oembed: false,
description: data["name"]
}
end
@ -18,7 +19,8 @@ def to_map(%Object{data: %{"url" => url} = data}, _opts) when is_binary(url) do
url: url |> Pleroma.Web.MediaProxy.url(),
mimetype: data["mediaType"] || url["mimeType"],
id: data["uuid"],
oembed: false
oembed: false,
description: data["name"]
}
end

View file

@ -23,7 +23,8 @@ test "represent an image attachment" do
id: 6,
url: "someurl",
mimetype: "sometype",
oembed: false
oembed: false,
description: nil
}
assert expected_object == ObjectRepresenter.to_map(object)
@ -46,7 +47,8 @@ test "represents mastodon-style attachments" do
"http://mastodon.example.org/system/media_attachments/files/000/000/001/original/8619f31c6edec470.png",
mimetype: "image/png",
oembed: false,
id: nil
id: nil,
description: "blabla"
}
assert expected_object == ObjectRepresenter.to_map(object)