aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoreal <eal@waifu.club>2018-08-07 21:56:50 +0300
committereal <eal@waifu.club>2018-08-07 21:56:50 +0300
commitc2d1a5e9c4f4ef316a2833914c8f134c00c95b75 (patch)
tree94c467b96da8033f08afbf7a5868d469c7a8b04e /lib
parent59b42531a3b01ab2a84a38b224f06146eb4bbc55 (diff)
downloadpleroma-c2d1a5e9c4f4ef316a2833914c8f134c00c95b75.tar.gz
MastoAPI AccountView: render profile emoji.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index f33d615cf..cc5261616 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -14,6 +14,18 @@ defmodule Pleroma.Web.MastodonAPI.AccountView 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 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
avatar_static: image,
header: header,
header_static: header,
- emojis: [],
+ emojis: emojis,
fields: [],
source: %{
note: "",