aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma')
-rw-r--r--lib/pleroma/user.ex7
-rw-r--r--lib/pleroma/user/info.ex6
-rw-r--r--lib/pleroma/web/activity_pub/transmogrifier.ex4
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index e71b33304..565218b4c 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -128,12 +128,17 @@ defmodule Pleroma.User do
params
|> Map.put(:last_refreshed_at, NaiveDateTime.utc_now())
+ info_cng =
+ struct.info
+ |> User.Info.user_upgrade(params[:info])
+
struct
- |> cast(params, [:bio, :name, :info, :follower_address, :avatar, :last_refreshed_at])
+ |> cast(params, [:bio, :name, :follower_address, :avatar, :last_refreshed_at])
|> unique_constraint(:nickname)
|> validate_format(:nickname, ~r/^[a-zA-Z\d]+$/)
|> validate_length(:bio, max: 5000)
|> validate_length(:name, max: 100)
+ |> put_embed(:info, info_cng)
end
def password_update_changeset(struct, params) do
diff --git a/lib/pleroma/user/info.ex b/lib/pleroma/user/info.ex
index 4a4c620ed..b664af81c 100644
--- a/lib/pleroma/user/info.ex
+++ b/lib/pleroma/user/info.ex
@@ -90,4 +90,10 @@ defmodule Pleroma.User.Info do
info
|> cast(params, [:source_data])
end
+
+ # Receives data from user_data_from_user_object
+ def user_upgrade(info, params) do
+ info
+ |> cast(params, [:ap_enabled, :source_data, :banner, :locked])
+ end
end
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
index 5864855b0..2d11c40c5 100644
--- a/lib/pleroma/web/activity_pub/transmogrifier.ex
+++ b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -850,10 +850,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
def upgrade_user_from_ap_id(ap_id, async \\ true) do
with %User{local: false} = user <- User.get_by_ap_id(ap_id),
{:ok, data} <- ActivityPub.fetch_and_prepare_user_from_ap_id(ap_id) do
- data =
- data
- |> Map.put(:info, Map.merge(user.info, data[:info]))
-
already_ap = User.ap_enabled?(user)
{:ok, user} =