twitter api: provide object descriptions as attachment description field
authorWilliam Pitcock <nenolod@dereferenced.org>
Sat, 25 Aug 2018 00:03:25 +0000 (00:03 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sat, 25 Aug 2018 00:12:58 +0000 (00:12 +0000)
lib/pleroma/web/twitter_api/representers/object_representer.ex
test/web/twitter_api/representers/object_representer_test.exs

index 60e30191f4041e3047f3d2af294846e5cffff060..6aa794a59d5d219f13f8e94d5fa68453a727e258 100644 (file)
@@ -9,7 +9,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter 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 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter do
       url: url |> Pleroma.Web.MediaProxy.url(),
       mimetype: data["mediaType"] || url["mimeType"],
       id: data["uuid"],
-      oembed: false
+      oembed: false,
+      description: data["name"]
     }
   end
 
index ebac051dc0005d2a574548c714f113acb4783072..228b2ac4262cb9654ee08441486bf51c9917f076 100644 (file)
@@ -23,7 +23,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ObjectReprenterTest do
       id: 6,
       url: "someurl",
       mimetype: "sometype",
-      oembed: false
+      oembed: false,
+      description: nil
     }
 
     assert expected_object == ObjectRepresenter.to_map(object)
@@ -46,7 +47,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ObjectReprenterTest 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)