71e47d2c16fba1f05a646d66d7f1848810c1b9b4
[akkoma] / lib / pleroma / web / static_fe / static_fe_view.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.StaticFE.StaticFEView do
6 use Pleroma.Web, :view
7
8 alias Pleroma.User
9 alias Pleroma.Web.MediaProxy
10 alias Pleroma.Formatter
11
12 import Phoenix.HTML
13
14 def emoji_for_user(%User{} = user) do
15 (user.info.source_data["tag"] || [])
16 |> Enum.filter(fn %{"type" => t} -> t == "Emoji" end)
17 |> Enum.map(fn %{"icon" => %{"url" => url}, "name" => name} ->
18 {String.trim(name, ":"), url}
19 end)
20 end
21 end