info_cng = User.Info.remote_user_creation(%User.Info{}, params[:info])
changes =
- %User{info: %{}}
+ %User{}
|> cast(params, [:bio, :name, :ap_id, :nickname, :avatar])
|> validate_required([:name, :ap_id])
|> unique_constraint(:nickname)
user
else
changes =
- %User{info: %{}}
+ %User{info: %User.Info{}}
|> cast(%{}, [:ap_id, :nickname, :local])
|> put_change(:ap_id, relay_uri)
|> put_change(:nickname, nil)
data =
data
|> Map.put(:name, blank?(data[:name]) || data[:nickname])
- |> Map.put(:info, data[:info] || %{})
cs = User.remote_user_creation(data)
+
Repo.insert(cs, on_conflict: :replace_all, conflict_target: :nickname)
end
def remote_user_creation(info, params) do
info
- |> cast(params, [:source_data])
+ |> cast(params, [
+ :ap_enabled,
+ :source_data,
+ :banner,
+ :locked
+ ])
end
# Receives data from user_data_from_user_object
archaeme =
insert(:user, %{
nickname: "archaeme",
- info: %{"source_data" => %{"url" => "https://archeme/@archaeme"}}
+ info: %Pleroma.User.Info{source_data: %{"url" => "https://archeme/@archaeme"}}
})
archaeme_remote = insert(:user, %{nickname: "archaeme@archae.me"})