twitter api: fix up activity representer
authorWilliam Pitcock <nenolod@dereferenced.org>
Sun, 27 Jan 2019 12:27:37 +0000 (12:27 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Mon, 28 Jan 2019 05:53:17 +0000 (05:53 +0000)
lib/pleroma/web/twitter_api/representers/activity_representer.ex

index 19b723586bd804f8382156594ad469d2531b6147..364aa7af3906025e18f4c4d09c043b8c1500f696 100644 (file)
@@ -12,6 +12,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
   alias Pleroma.Web.CommonAPI.Utils
   alias Pleroma.Formatter
   alias Pleroma.HTML
+  alias Pleroma.Web.MastodonAPI
+  alias Pleroma.Web.MastodonAPI.StatusView
 
   defp user_by_ap_id(user_list, ap_id) do
     Enum.find(user_list, fn %{ap_id: user_id} -> ap_id == user_id end)
@@ -186,6 +188,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
 
     summary = HTML.strip_tags(object["summary"])
 
+    card = StatusView.render("card.json", MastodonAPI.get_status_card(activity.id))
+
     %{
       "id" => activity.id,
       "uri" => activity.data["object"]["id"],
@@ -214,7 +218,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "possibly_sensitive" => possibly_sensitive,
       "visibility" => Pleroma.Web.MastodonAPI.StatusView.get_visibility(object),
       "summary" => summary,
-      "summary_html" => summary |> Formatter.emojify(object["emoji"])
+      "summary_html" => summary |> Formatter.emojify(object["emoji"]),
+      "card" => card
     }
   end