diff options
author | lain <lain@soykaf.club> | 2020-01-20 16:24:20 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-01-20 16:24:20 +0100 |
commit | 4c5b5f14dcec51cba8e86bcfcf2943ee9b49b0e4 (patch) | |
tree | 9a1200ec687670fc12e7f9dc65b3100530c68b1d /lib | |
parent | 42ea480e95862c09c07f6b4711648c192a66fdf5 (diff) | |
download | pleroma-4c5b5f14dcec51cba8e86bcfcf2943ee9b49b0e4.tar.gz |
StatusView: Add `emoji_reactions`
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/status_view.ex | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index e9590224b..b59ac39bc 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -253,6 +253,16 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do nil end + emoji_reactions = + with %{data: %{"reactions" => emoji_reactions}} <- object do + Enum.map(emoji_reactions, fn {emoji, users} -> + {emoji, length(users)} + end) + |> Enum.into(%{}) + else + _ -> %{} + end + %{ id: to_string(activity.id), uri: object.data["id"], @@ -293,7 +303,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do spoiler_text: %{"text/plain" => summary_plaintext}, expires_at: expires_at, direct_conversation_id: direct_conversation_id, - thread_muted: thread_muted? + thread_muted: thread_muted?, + emoji_reactions: emoji_reactions } } end |