1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.PleromaAPI.EmojiReactionView do
8 alias Pleroma.Web.MastodonAPI.AccountView
10 def render("index.json", %{emoji_reactions: emoji_reactions} = opts) do
11 render_many(emoji_reactions, __MODULE__, "show.json", opts)
14 def render("show.json", %{emoji_reaction: {emoji, user_ap_ids}, user: user}) do
15 users = fetch_users(user_ap_ids)
20 accounts: render(AccountView, "index.json", users: users, for: user),
21 me: !!(user && user.ap_id in user_ap_ids)
25 defp fetch_users(user_ap_ids) do
27 |> Enum.map(&Pleroma.User.get_cached_by_ap_id/1)
29 %{deactivated: false} -> true