aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-08-07 18:14:22 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-08-14 14:58:06 +0700
commite457fcc47971df6c76c3da096e6b45c2972e4029 (patch)
treec0bc15422680b71c08ee62388bf8c7156ed38371 /lib/pleroma/web
parentf7bbf99caade7f06756e95e3a4e2f0e4d3e76579 (diff)
downloadpleroma-e457fcc47971df6c76c3da096e6b45c2972e4029.tar.gz
Add `:max_remote_account_fields` config option
Diffstat (limited to 'lib/pleroma/web')
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex7
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex2
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index cf55c9520..7bb7740bf 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -1016,6 +1016,12 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
"url" => [%{"href" => data["image"]["url"]}]
}
+ fields =
+ data
+ |> Map.get("attachment", [])
+ |> Enum.filter(fn %{"type" => t} -> t == "PropertyValue" end)
+ |> Enum.map(fn fields -> Map.take(fields, ["name", "value"]) end)
+
locked = data["manuallyApprovesFollowers"] || false
data = Transmogrifier.maybe_fix_user_object(data)
@@ -1025,6 +1031,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
ap_enabled: true,
source_data: data,
banner: banner,
+ fields: fields,
locked: locked
},
avatar: avatar,
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index 2be2e3294..36340a3a1 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -611,7 +611,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|> Map.put(:info, %{banner: banner, locked: locked, fields: fields})
actor
- |> User.upgrade_changeset(update_data)
+ |> User.upgrade_changeset(update_data, true)
|> User.update_and_set_cache()
ActivityPub.update(%{