twitter api: embed card in twitterapi posts
authorWilliam Pitcock <nenolod@dereferenced.org>
Sun, 27 Jan 2019 12:16:08 +0000 (12:16 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Mon, 28 Jan 2019 05:53:17 +0000 (05:53 +0000)
lib/pleroma/web/twitter_api/views/activity_view.ex

index a01ee00106f47fbd761c92fbdb0ecfe032431a59..77e9af34839f06cb10eed614e00be6e9d4fec71b 100644 (file)
@@ -10,6 +10,8 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
   alias Pleroma.Web.TwitterAPI.ActivityView
   alias Pleroma.Web.TwitterAPI.TwitterAPI
   alias Pleroma.Web.TwitterAPI.Representers.ObjectRepresenter
+  alias Pleroma.Web.MastodonAPI
+  alias Pleroma.Web.MastodonAPI.StatusView
   alias Pleroma.Activity
   alias Pleroma.HTML
   alias Pleroma.Object
@@ -274,6 +276,8 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
 
     summary = HTML.strip_tags(summary)
 
+    card = StatusView.render("card.json", MastodonAPI.get_status_card(activity.id))
+
     %{
       "id" => activity.id,
       "uri" => activity.data["object"]["id"],
@@ -300,9 +304,10 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
       "tags" => tags,
       "activity_type" => "post",
       "possibly_sensitive" => possibly_sensitive,
-      "visibility" => Pleroma.Web.MastodonAPI.StatusView.get_visibility(object),
+      "visibility" => StatusView.get_visibility(object),
       "summary" => summary,
-      "summary_html" => summary |> Formatter.emojify(object["emoji"])
+      "summary_html" => summary |> Formatter.emojify(object["emoji"]),
+      "card" => card
     }
   end