diff options
author | Egor Kislitsyn <egor@kislitsyn.com> | 2019-08-07 18:48:05 +0700 |
---|---|---|
committer | Egor Kislitsyn <egor@kislitsyn.com> | 2019-08-14 14:58:06 +0700 |
commit | 672fcbc7b716f18346a17845d05c286b45dca5f3 (patch) | |
tree | a27360cc3744a89c2f43419b1b9c192f095174d0 /lib | |
parent | e457fcc47971df6c76c3da096e6b45c2972e4029 (diff) | |
download | pleroma-672fcbc7b716f18346a17845d05c286b45dca5f3.tar.gz |
Limit custom fields for old remote users
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user/info.ex | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex index 47e7df911..45a39924b 100644 --- a/lib/pleroma/user/info.ex +++ b/lib/pleroma/user/info.ex @@ -423,9 +423,12 @@ defmodule Pleroma.User.Info do # ``fields`` is an array of mastodon profile field, containing ``{"name": "…", "value": "…"}``. # For example: [{"name": "Pronoun", "value": "she/her"}, …] def fields(%{fields: [], source_data: %{"attachment" => attachment}}) do + limit = Pleroma.Config.get([:instance, :max_remote_account_fields], 0) + attachment |> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end) |> Enum.map(fn fields -> Map.take(fields, ["name", "value"]) end) + |> Enum.take(limit) end def fields(%{fields: fields}), do: fields |