mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 10:09:02 +00:00
Add custom fields to TwitterAPI.UserView
This commit is contained in:
parent
069951722f
commit
a22f540fc4
|
@ -407,6 +407,8 @@ defmodule Pleroma.User.Info do
|
|||
cast(info, params, [:muted_reblogs])
|
||||
end
|
||||
|
||||
# ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``.
|
||||
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
|
||||
def fields(%{source_data: %{"attachment" => attachment}}) do
|
||||
attachment
|
||||
|> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end)
|
||||
|
|
|
@ -74,12 +74,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
|
|||
|> HTML.filter_tags(User.html_filter_policy(for_user))
|
||||
|> Formatter.emojify(emoji)
|
||||
|
||||
# ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``.
|
||||
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
|
||||
fields =
|
||||
(user.info.source_data["attachment"] || [])
|
||||
|> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end)
|
||||
|> Enum.map(fn fields -> Map.take(fields, ["name", "value"]) end)
|
||||
fields = User.Info.fields(user.info)
|
||||
|
||||
data =
|
||||
%{
|
||||
|
|
Loading…
Reference in a new issue