MastoAPI AccountView: render profile emoji.

This commit is contained in:
eal 2018-08-07 21:56:50 +03:00
parent 59b42531a3
commit c2d1a5e9c4
1 changed files with 13 additions and 1 deletions

View File

@ -14,6 +14,18 @@ def render("account.json", %{user: user}) do
header = User.banner_url(user) |> MediaProxy.url()
user_info = User.user_info(user)
emojis =
(user.info["source_data"]["tag"] || [])
|> Enum.filter(fn %{"type" => t} -> t == "Emoji" end)
|> Enum.map(fn %{"icon" => %{"url" => url}, "name" => name} ->
%{
"shortcode" => String.trim(name, ":"),
"url" => MediaProxy.url(url),
"static_url" => MediaProxy.url(url),
"visible_in_picker" => false
}
end)
%{
id: to_string(user.id),
username: hd(String.split(user.nickname, "@")),
@ -30,7 +42,7 @@ def render("account.json", %{user: user}) do
avatar_static: image,
header: header,
header_static: header,
emojis: [],
emojis: emojis,
fields: [],
source: %{
note: "",