1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-12-25 04:53:06 +00:00

[Pleroma.Web.MastodonAPI.AccountView]: Add fields support

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-08-10 02:41:01 +02:00
parent d008f2d69c
commit a5adb251ab
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -27,6 +27,11 @@ def render("account.json", %{user: user}) do
}
end)
fields =
(user.info["source_data"]["attachment"] || [])
|> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end)
|> Enum.map(fn fields -> Map.take(fields, ["name", "value"]) end)
%{
id: to_string(user.id),
username: hd(String.split(user.nickname, "@")),
@ -44,7 +49,7 @@ def render("account.json", %{user: user}) do
header: header,
header_static: header,
emojis: emojis,
fields: [],
fields: fields,
bot: bot,
source: %{
note: "",