forked from YokaiRick/akkoma
Limit custom fields for old remote users
This commit is contained in:
parent
e457fcc479
commit
672fcbc7b7
1 changed files with 3 additions and 0 deletions
|
@ -423,9 +423,12 @@ def remove_reblog_mute(info, ap_id) do
|
||||||
# ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``.
|
# ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``.
|
||||||
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
|
# For example: [{"name": "Pronoun", "value": "she/her"}, …]
|
||||||
def fields(%{fields: [], source_data: %{"attachment" => attachment}}) do
|
def fields(%{fields: [], source_data: %{"attachment" => attachment}}) do
|
||||||
|
limit = Pleroma.Config.get([:instance, :max_remote_account_fields], 0)
|
||||||
|
|
||||||
attachment
|
attachment
|
||||||
|> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end)
|
|> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end)
|
||||||
|> Enum.map(fn fields -> Map.take(fields, ["name", "value"]) end)
|
|> Enum.map(fn fields -> Map.take(fields, ["name", "value"]) end)
|
||||||
|
|> Enum.take(limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fields(%{fields: fields}), do: fields
|
def fields(%{fields: fields}), do: fields
|
||||||
|
|
Loading…
Reference in a new issue