aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2020-01-21 13:13:17 +0000
committerrinpatch <rinpatch@sdf.org>2020-01-21 13:13:17 +0000
commit04c9ca5d68eb4d9c8abc82a91d5df3c483089b9b (patch)
tree11329fbfa6610fa3351007e9d093e285e9ee42dc /lib
parentfa47a719901050b27534492b0ff7189bc78895eb (diff)
parent7d8b709d293064462256d9a6392f993232323a4d (diff)
downloadpleroma-04c9ca5d68eb4d9c8abc82a91d5df3c483089b9b.tar.gz
Merge branch 'emoji-reaction-extensions' into 'develop'
StatusView: Add `emoji_reactions` See merge request pleroma/pleroma!2120
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex13
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