forked from AkkomaGang/akkoma
[Pleroma.Web.MastodonAPI.AccountView]: Add fields support
This commit is contained in:
parent
d008f2d69c
commit
a5adb251ab
1 changed files with 6 additions and 1 deletions
|
@ -27,6 +27,11 @@ def render("account.json", %{user: user}) do
|
||||||
}
|
}
|
||||||
end)
|
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),
|
id: to_string(user.id),
|
||||||
username: hd(String.split(user.nickname, "@")),
|
username: hd(String.split(user.nickname, "@")),
|
||||||
|
@ -44,7 +49,7 @@ def render("account.json", %{user: user}) do
|
||||||
header: header,
|
header: header,
|
||||||
header_static: header,
|
header_static: header,
|
||||||
emojis: emojis,
|
emojis: emojis,
|
||||||
fields: [],
|
fields: fields,
|
||||||
bot: bot,
|
bot: bot,
|
||||||
source: %{
|
source: %{
|
||||||
note: "",
|
note: "",
|
||||||
|
|
Loading…
Reference in a new issue