forked from AkkomaGang/akkoma
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 @@ def remote_user_creation(params) 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 @@ def get_or_create_instance_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 @@ def insert_or_update_user(data) 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 @@ def set_keys(info, keys) 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 @@ test "gives a replacement for user links" 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