summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>2018-08-10 02:41:01 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2018-08-27 15:09:05 +0200
commita5adb251ab101e7ad1084a772b66b049998c72a5 (patch)
treeae0df2e1b3e54665f7bf0e43a916e542f687a197
parentd008f2d69c96616f8d665851994414d1b42f8761 (diff)
downloadpleroma-a5adb251ab101e7ad1084a772b66b049998c72a5.tar.gz
pleroma-a5adb251ab101e7ad1084a772b66b049998c72a5.zip
[Pleroma.Web.MastodonAPI.AccountView]: Add fields support
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex7
1 files changed, 6 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 9dd635a63..634985fb6 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -27,6 +27,11 @@ defmodule Pleroma.Web.MastodonAPI.AccountView 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 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
header: header,
header_static: header,
emojis: emojis,
- fields: [],
+ fields: fields,
bot: bot,
source: %{
note: "",