Skip to content
Snippets Groups Projects
Commit 6d0a4a60 authored by Ryan Senior's avatar Ryan Senior
Browse files

Fix `/api/user` POSTs to return the same data as PUT

The previous code returned the result of the `db/insert!` this changes
that to user the same `fetch-user` function that is used elsewhere in
the user API to ensure we get the same data back (specifically looking
for `is_active`).
parent 2146d539
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,8 @@
(api/check-superuser)
(api/checkp (not (db/exists? User :email email))
"email" "Email address already in use.")
(user/invite-user! first_name last_name email password @api/*current-user*))
(let [new-user-id (u/get-id (user/invite-user! first_name last_name email password @api/*current-user*))]
(fetch-user :id new-user-id)))
(api/defendpoint GET "/current"
"Fetch the current `User`."
......
......@@ -80,22 +80,20 @@
(let [user-name (random-name)
email (str user-name "@metabase.com")]
(expect
{:email email
:first_name user-name
:last_name user-name
:common_name (str user-name " " user-name)
:is_superuser false
:is_qbnewb true
:is_active true}
(merge user-defaults
{:email email
:first_name user-name
:last_name user-name
:common_name (str user-name " " user-name)})
(et/with-fake-inbox
((user->client :crowberto) :post 200 "user" {:first_name user-name
:last_name user-name
:email email})
(u/prog1 (db/select-one [User :email :first_name :last_name :is_superuser :is_qbnewb :is_active]
:email email)
;; clean up after ourselves
(db/delete! User :email email)))))
(try
(tu/boolean-ids-and-timestamps
((user->client :crowberto) :post 200 "user" {:first_name user-name
:last_name user-name
:email email}))
(finally
;; clean up after ourselves
(db/delete! User :email email))))))
;; Test that reactivating a disabled account works
(expect
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment