From aab2bdddf4456c99d5d5042183c1225f7e771f56 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 25 Aug 2018 00:03:25 +0000 Subject: [PATCH] twitter api: provide object descriptions as attachment description field --- .../web/twitter_api/representers/object_representer.ex | 6 ++++-- .../twitter_api/representers/object_representer_test.exs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/twitter_api/representers/object_representer.ex b/lib/pleroma/web/twitter_api/representers/object_representer.ex index 60e30191f..6aa794a59 100644 --- a/lib/pleroma/web/twitter_api/representers/object_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/object_representer.ex @@ -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 diff --git a/test/web/twitter_api/representers/object_representer_test.exs b/test/web/twitter_api/representers/object_representer_test.exs index ebac051dc..228b2ac42 100644 --- a/test/web/twitter_api/representers/object_representer_test.exs +++ b/test/web/twitter_api/representers/object_representer_test.exs @@ -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)