Mix format.

This commit is contained in:
lain 2018-11-18 21:41:35 +01:00
parent 4c918392c6
commit cafa15131a
2 changed files with 21 additions and 14 deletions

View File

@ -80,7 +80,8 @@ def user_info(%User{} = user) do
@email_regex ~r/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/ @email_regex ~r/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
def remote_user_creation(params) do def remote_user_creation(params) do
params = params params =
params
|> Map.put(:info, params[:info] || %{}) |> Map.put(:info, params[:info] || %{})
info_cng = User.Info.remote_user_creation(%User.Info{}, params[:info]) info_cng = User.Info.remote_user_creation(%User.Info{}, params[:info])
@ -598,20 +599,24 @@ def blocks?(user, %{ap_id: ap_id}) do
end end
def block_domain(user, domain) do def block_domain(user, domain) do
info_cng = user.info info_cng =
user.info
|> User.Info.add_to_domain_block(domain) |> User.Info.add_to_domain_block(domain)
cng = change(user) cng =
change(user)
|> put_embed(:info, info_cng) |> put_embed(:info, info_cng)
update_and_set_cache(cng) update_and_set_cache(cng)
end end
def unblock_domain(user, domain) do def unblock_domain(user, domain) do
info_cng = user.info info_cng =
user.info
|> User.Info.remove_from_domain_block(domain) |> User.Info.remove_from_domain_block(domain)
cng = change(user) cng =
change(user)
|> put_embed(:info, info_cng) |> put_embed(:info, info_cng)
update_and_set_cache(cng) update_and_set_cache(cng)

View File

@ -120,10 +120,12 @@ def ensure_keys_present(user) do
else else
{:ok, pem} = Salmon.generate_rsa_pem() {:ok, pem} = Salmon.generate_rsa_pem()
info_cng = info info_cng =
info
|> Pleroma.User.Info.set_keys(pem) |> Pleroma.User.Info.set_keys(pem)
cng = Ecto.Changeset.change(user) cng =
Ecto.Changeset.change(user)
|> Ecto.Changeset.put_embed(:info, info_cng) |> Ecto.Changeset.put_embed(:info, info_cng)
User.update_and_set_cache(cng) User.update_and_set_cache(cng)