summary = object.data["summary"] || ""
- summary_html =
- summary
- |> HTML.get_cached_scrubbed_html_for_activity(
- User.html_filter_policy(opts[:for]),
- activity,
- "mastoapi:summary"
- )
-
- summary_plaintext =
- summary
- |> HTML.get_cached_stripped_html_for_activity(
- activity,
- "mastoapi:summary"
- )
-
card = render("card.json", Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity))
url =
nil
end
+ emoji_reactions =
+ with %{data: %{"reactions" => emoji_reactions}} <- object do
+ Enum.map(emoji_reactions, fn [emoji, users] ->
+ %{
+ name: emoji,
+ count: length(users),
+ me: !!(opts[:for] && opts[:for].ap_id in users)
+ }
+ end)
+ else
+ _ -> []
+ end
+
%{
id: to_string(activity.id),
uri: object.data["id"],
muted: thread_muted? || User.mutes?(opts[:for], user),
pinned: pinned?(activity, user),
sensitive: sensitive,
- spoiler_text: summary_html,
+ spoiler_text: summary,
visibility: get_visibility(object),
media_attachments: attachments,
poll: render(PollView, "show.json", object: object, for: opts[:for]),
conversation_id: get_context_id(activity),
in_reply_to_account_acct: reply_to_user && reply_to_user.nickname,
content: %{"text/plain" => content_plaintext},
- spoiler_text: %{"text/plain" => summary_plaintext},
+ spoiler_text: %{"text/plain" => summary},
expires_at: expires_at,
direct_conversation_id: direct_conversation_id,
- thread_muted: thread_muted?
+ thread_muted: thread_muted?,
+ emoji_reactions: emoji_reactions
}
}
end
end
end
- def render_content(%{data: %{"type" => "Video"}} = object) do
+ def render_content(%{data: %{"type" => object_type}} = object)
+ when object_type in ["Video", "Event"] do
with name when not is_nil(name) and name != "" <- object.data["name"] do
"<p><a href=\"#{object.data["id"]}\">#{name}</a></p>#{object.data["content"]}"
else