twitter api: fix up activity representer

This commit is contained in:
William Pitcock 2019-01-27 12:27:37 +00:00
parent 364cf5369b
commit 07a9a891ad
1 changed files with 6 additions and 1 deletions

View File

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