1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-18 10:59:17 +00:00

Web.AdminAPI.AdminAPIController: Fixes bugs found with ExUnit

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-11-17 22:10:23 +01:00
parent 76bd80d462
commit 0ca00b3a07
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -10,7 +10,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
def user_delete(conn, %{"nickname" => nickname}) do
user = User.get_by_nickname(nickname)
if user[:local] == true do
if user.local == true do
User.delete(user)
else
User.delete(user)
@ -20,21 +20,21 @@ def user_delete(conn, %{"nickname" => nickname}) do
|> json(nickname)
end
def user_create(conn, %{
user: %{"nickname" => nickname, "email" => email, "password" => password} = user
}) do
new_user = %User{
def user_create(
conn,
%{"nickname" => nickname, "email" => email, "password" => password}
) do
new_user = %{
nickname: nickname,
name: user.name || nickname,
name: nickname,
email: email,
password: password,
password_confirmation: password,
bio: user.bio || "."
bio: "."
}
User.register_changeset(%User{}, new_user)
Repo.insert!(new_user)
|> Repo.insert!()
conn
|> json(new_user.nickname)