Commit deb301dd authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch...

Merge branch '26327-include-whether-an-email-is-verified-in-the-user-emails-api-endpoint-result' into 'master'

Return email confirmation time from email entity

See merge request gitlab-org/gitlab!58957
parents 0e619e01 e295483f
---
title: Return email confirmation time from email entity
merge_request: 58957
author:
type: changed
...@@ -1213,11 +1213,13 @@ GET /user/emails ...@@ -1213,11 +1213,13 @@ GET /user/emails
[ [
{ {
"id": 1, "id": 1,
"email": "email@example.com" "email": "email@example.com",
"confirmed_at" : "2021-03-26T19:07:56.248Z"
}, },
{ {
"id": 3, "id": 3,
"email": "email2@example.com" "email": "email2@example.com",
"confirmed_at" : null
} }
] ]
``` ```
...@@ -1257,7 +1259,8 @@ Parameters: ...@@ -1257,7 +1259,8 @@ Parameters:
```json ```json
{ {
"id": 1, "id": 1,
"email": "email@example.com" "email": "email@example.com",
"confirmed_at" : "2021-03-26T19:07:56.248Z"
} }
``` ```
...@@ -1276,7 +1279,8 @@ Parameters: ...@@ -1276,7 +1279,8 @@ Parameters:
```json ```json
{ {
"id": 4, "id": 4,
"email": "email@example.com" "email": "email@example.com",
"confirmed_at" : "2021-03-26T19:07:56.248Z"
} }
``` ```
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module API module API
module Entities module Entities
class Email < Grape::Entity class Email < Grape::Entity
expose :id, :email expose :id, :email, :confirmed_at
end end
end end
end end
...@@ -1795,8 +1795,7 @@ RSpec.describe API::Users do ...@@ -1795,8 +1795,7 @@ RSpec.describe API::Users do
post api("/users/#{user.id}/emails", admin), params: email_attrs post api("/users/#{user.id}/emails", admin), params: email_attrs
end.to change { user.emails.count }.by(1) end.to change { user.emails.count }.by(1)
email = Email.find_by(user_id: user.id, email: email_attrs[:email]) expect(json_response['confirmed_at']).to be_nil
expect(email).not_to be_confirmed
end end
it "returns a 400 for invalid ID" do it "returns a 400 for invalid ID" do
...@@ -1813,8 +1812,7 @@ RSpec.describe API::Users do ...@@ -1813,8 +1812,7 @@ RSpec.describe API::Users do
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
email = Email.find_by(user_id: user.id, email: email_attrs[:email]) expect(json_response['confirmed_at']).not_to be_nil
expect(email).to be_confirmed
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment