mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Fix formatter tests.
This commit is contained in:
parent
fbb70d25fe
commit
2887f4ff1d
3 changed files with 10 additions and 5 deletions
|
@ -87,7 +87,7 @@ defmodule Pleroma.User do
|
||||||
info_cng = User.Info.remote_user_creation(%User.Info{}, params[:info])
|
info_cng = User.Info.remote_user_creation(%User.Info{}, params[:info])
|
||||||
|
|
||||||
changes =
|
changes =
|
||||||
%User{info: %{}}
|
%User{}
|
||||||
|> cast(params, [:bio, :name, :ap_id, :nickname, :avatar])
|
|> cast(params, [:bio, :name, :ap_id, :nickname, :avatar])
|
||||||
|> validate_required([:name, :ap_id])
|
|> validate_required([:name, :ap_id])
|
||||||
|> unique_constraint(:nickname)
|
|> unique_constraint(:nickname)
|
||||||
|
@ -718,7 +718,7 @@ defmodule Pleroma.User do
|
||||||
user
|
user
|
||||||
else
|
else
|
||||||
changes =
|
changes =
|
||||||
%User{info: %{}}
|
%User{info: %User.Info{}}
|
||||||
|> cast(%{}, [:ap_id, :nickname, :local])
|
|> cast(%{}, [:ap_id, :nickname, :local])
|
||||||
|> put_change(:ap_id, relay_uri)
|
|> put_change(:ap_id, relay_uri)
|
||||||
|> put_change(:nickname, nil)
|
|> put_change(:nickname, nil)
|
||||||
|
@ -763,9 +763,9 @@ defmodule Pleroma.User do
|
||||||
data =
|
data =
|
||||||
data
|
data
|
||||||
|> Map.put(:name, blank?(data[:name]) || data[:nickname])
|
|> Map.put(:name, blank?(data[:name]) || data[:nickname])
|
||||||
|> Map.put(:info, data[:info] || %{})
|
|
||||||
|
|
||||||
cs = User.remote_user_creation(data)
|
cs = User.remote_user_creation(data)
|
||||||
|
|
||||||
Repo.insert(cs, on_conflict: :replace_all, conflict_target: :nickname)
|
Repo.insert(cs, on_conflict: :replace_all, conflict_target: :nickname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,12 @@ defmodule Pleroma.User.Info do
|
||||||
|
|
||||||
def remote_user_creation(info, params) do
|
def remote_user_creation(info, params) do
|
||||||
info
|
info
|
||||||
|> cast(params, [:source_data])
|
|> cast(params, [
|
||||||
|
:ap_enabled,
|
||||||
|
:source_data,
|
||||||
|
:banner,
|
||||||
|
:locked
|
||||||
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Receives data from user_data_from_user_object
|
# Receives data from user_data_from_user_object
|
||||||
|
|
|
@ -110,7 +110,7 @@ defmodule Pleroma.FormatterTest do
|
||||||
archaeme =
|
archaeme =
|
||||||
insert(:user, %{
|
insert(:user, %{
|
||||||
nickname: "archaeme",
|
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"})
|
archaeme_remote = insert(:user, %{nickname: "archaeme@archae.me"})
|
||||||
|
|
Loading…
Reference in a new issue