Fix formatter tests.

This commit is contained in:
lain 2018-11-20 19:07:01 +01:00
parent fbb70d25fe
commit 2887f4ff1d
3 changed files with 10 additions and 5 deletions

View file

@ -87,7 +87,7 @@ def remote_user_creation(params) do
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)
@ -718,7 +718,7 @@ def get_or_create_instance_user do
user
else
changes =
%User{info: %{}}
%User{info: %User.Info{}}
|> cast(%{}, [:ap_id, :nickname, :local])
|> put_change(:ap_id, relay_uri)
|> put_change(:nickname, nil)
@ -763,9 +763,9 @@ def insert_or_update_user(data) do
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

View file

@ -89,7 +89,12 @@ def set_keys(info, keys) do
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

View file

@ -110,7 +110,7 @@ test "gives a replacement for user links" do
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"})